Html Custom field – embed a google map route

This topic contains 36 replies, has 4 voices, and was last updated by  Paolo 6 years, 10 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #384944

    S
    Expired Member
    Post count: 62

    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.

    #384947

    Kor
    Moderator
    Post count: 16516

    Hi 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!

    #384993

    S
    Expired Member
    Post count: 62
    This reply has been marked as private.
    #385028

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    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 5

    If you provide a link and admin credentials we will have a look.

    Thanks

    #385031

    S
    Expired Member
    Post count: 62
    This reply has been marked as private.
    #385040

    Stiofan O’Connor
    Site Admin
    Post count: 22956
    This reply has been marked as private.
    #385046

    S
    Expired Member
    Post count: 62

    I 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?

    #385113

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    I 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

    #385129

    S
    Expired Member
    Post count: 62

    Thank 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?

    #385130

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You 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

    #385133

    S
    Expired Member
    Post count: 62

    The listing is a trip (or route) of which the departure and destination addresses/locations are fixed by the user. Thanks.

    #385135

    S
    Expired Member
    Post count: 62

    FYI, 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.

    #385138

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    My 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

    #385139

    S
    Expired Member
    Post count: 62
    This reply has been marked as private.
    #385141

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    A 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

Viewing 15 posts - 1 through 15 (of 37 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket