I am trying to use [LOCATION] shortcode to display address. I don’t want to display HTML which renders with the shortcode
<span class=”wlt_shortcode_location”>Los Angeles, CA 90057, United States <i class=”fa fa-info-circle wlt_pop_location_37″ style=”cursor:pointer;” rel=”popover” data-placement=”top” data-original-title=”Useful Links” data-trigger=”hover”></i></span>
So it outputs just the address as Los Angeles, CA 90057, United States
Same for the [MAP-ZIP] as well.
You can create a new shortcode for that, just copy the function for the [LOCATION] shortcode and remove the html part from their. Then use your new shortcode in place of currently using [LOCATION]
Thanks Hemanta, Which file do I need to change, I checked the class_shortcodes but no luck.
Have you tried using the [map_location] instead?
Hi Mark, yes I did but same with this one too. I really need to know how to get the address out of shortcode with out any HTML. Anyone out there could help?
As said above , use [map_location] lower case !!!
lower case !!!
Does [LOCATION] shortcode exist ? I can’t found it shortcodes.php
I tried [map-location] but it renders as :
<span class=”wlt_shortcode_map_location”>Riverside, CA, United States</span>
How can I remove the <span> part from it ?
Ok did some research on Google and found this solution which works for me:
<script> var html = ‘[map_location]’; var div = document.createElement(“div”); div.innerHTML = html; var text = div.textContent || div.innerText || “”; alert(div.innerText); </script>
(Sorry Late response) @Najeeb Not sure why you want to remove the <span> but anyway,if using the [LOCATION] shortcode then try this in Theme Options >Design Setup >Custom Meta Data >Footer Styles [code title=””] <script> jQuery(“.wlt_shortcode_location”).contents().unwrap(); </script> [/code] @Hemanta The [LOCATION] shortcode does exist
@Josh, why [LOCATION] shortcode in not listed in shortcodes.php ?
@Hemanta it is listed in the file class_shortcodes.php.Try doing a search in the file
I have 3 search result for the keyword LOCATION, which one is for the [LOCATION] ?
@Josh First of all thank you very much for coming up with a solution !!
@ Hemanta I also tried to find the [location] shortcode in the files but couldn’t. But as the shortcode exists the codes must be present somewhere in the files, still looking.
@Najeeb, I needed a similar feature where I could output a custom field without the span and class added to it. I tried to modify core files, but that somehow broke my site so had to revert it back from backup. When I almost gave up, I found a plugin that can extract value of any custom field as a shortcode. You simply use [customfield name=”custom_field_name”] (where you replace the ‘custom_field_name’ with the name of your custom field). So in your case you would simply use [customfield name=”map_location”] and it will give you the value without any extra code or formatting.
Been using it for almost a year now and it is working a treat. Shame I did not find it earlier, could have saved me a lot of time and headaches (and I would have possibly more hear on my head).
You can find it here: https://premiumwebservices.co.uk/shop/premiumpress-plugins/custom-fields-shortcodes/
Start your new website today!