Html Custom field – embed a google map route
This topic contains 36 replies, has 4 voices, and was last updated by Paolo 7 years, 8 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
June 28, 2017 at 2:06 am #384944
I provide a html custom field and a user copies and pastes the HTML embed code for a google map that shows a specific route (in the text tab of the html space). The map appears under the visual tab of the html custom field when we are in the “edit place” page. However, the map does not show up on the actual website. Do you know why?
This is the code under the text tab of the html custom field.
Here is the map:
<iframe src=”https://www.google.com/maps/embed?pb=!1m28!1m12!1m3!1d3290654.5498798606!2d-82.89313752905547!3d36.34794325268274!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!4m13!3e6!4m5!1s0x89b7c41e0d714699%3A0xeb8c0de36dd36d95!2sCollege+Park%2C+MD!3m2!1d38.989696699999996!2d-76.93776!4m5!1s0x88f5045d6993098d%3A0x66fede2f990b630b!2sAtlanta%2C+GA!3m2!1d33.7489954!2d-84.3879824!5e0!3m2!1sen!2sus!4v1498614417131″ width=”600″ height=”450″ frameborder=”0″ style=”border:0″ allowfullscreen></iframe>On the website, only the text “Here is the map:” shows up. The map does not show up.
June 28, 2017 at 2:33 am #384947Hi there,
Are you getting any console errors? If you are not sure, please share the URL of the site in question and we’ll take a better look at it.
Thanks!
June 28, 2017 at 12:02 pm #384993This reply has been marked as private.June 28, 2017 at 4:32 pm #385028Hi,
there are plenty of errors in your console.
Example:
TypeError: _.Xc is not a function
https://maps.google.com/maps-api-v3/api/js/29/8/geocoder.js
Line 5If you provide a link and admin credentials we will have a look.
Thanks
June 28, 2017 at 5:02 pm #385031This reply has been marked as private.June 28, 2017 at 5:50 pm #385040This reply has been marked as private.June 28, 2017 at 6:12 pm #385046I haven’t figured out how to allow the front end users to insert map with route through the map press plugin. So no, I am not using that plugin. I was just trying to get the map embedding to work through html custom field.
I saw that it worked for you. It seems like you did exactly what I did before. However, I logged in myself and went to edit the post. I did not change anything and I just updated the post.Now the map doesn’t show up again. Do you know why?
June 29, 2017 at 10:10 am #385113I have added the below code snippet to allow that field to allow iframes
function _my_allow_iframe_maproute($tags, $pkey) { if ($pkey == 'geodir_maproute') { $tags = '<iframe>'; } return $tags; } add_filter('geodir_save_post_key', '_my_allow_iframe_maproute', 10, 2);
Thanks,
Stiofan
June 29, 2017 at 12:02 pm #385129Thank you! It is working fine. Just curious. Do you have any better suggestion about any plugins (or add-ons or code customization) that works with geodirectory that allows a user to create a map with route by entering just two addresses (departure address and destination address) in the add listing page?
June 29, 2017 at 12:31 pm #385130You could make your own custom field.
Is either end of the route fixed, is one end the actual listing location?
Please explain and i’ll tell you the best solution.Stiofan
June 29, 2017 at 1:08 pm #385133The listing is a trip (or route) of which the departure and destination addresses/locations are fixed by the user. Thanks.
June 29, 2017 at 1:45 pm #385135FYI, I will use the destination address to be the default geodirectory listing address of the trip but I would like the user to enter/fix the departing address as well to create a route on a map.
June 29, 2017 at 2:26 pm #385138My point is, is it from a fixed location to the listing location, like from an airport to the listing locations?
#1 departure: is this fixed for all listing or different for all listings or the listing address?
#2 destination: is this fixed for all listing or different for all listings or the listing address?
Please explain fully or i cant help.
Stiofan
June 29, 2017 at 2:36 pm #385139This reply has been marked as private.June 29, 2017 at 2:46 pm #385141A little 🙂
Then your options are to either let them enter the iframe code or create your own fields or output from standard fields. The ideal might be just a lat/lon inputs or zips codes, if you use an address it might not always be entered or interpreted correctly. and then have it output this on a map.
Stiofan
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket