Store map in variable

Support MB Geolocation Store map in variableResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #45512
    Topher DeRosiaTopher DeRosia
    Participant

    rwmb_the_value( 'hba_event_map', $args ); prints my map.

    rwmb_get_value( 'hba_event_map', $args ); gives me an array of coordinates.

    I want to render the map with a shortcode, which means I need to return it, not echo it.

    So I did this:

        ob_start();
        echo '<p>';
        rwmb_the_value( 'hba_event_map', $args );
        echo '</p>';
        $map = ob_get_contents();
        ob_end_clean();
    
        return $map;

    This seems to work, but then when I use my shortcode, and then put something after it, the gutenberg editor includes the thing after it inside the anchor tag for the map.

    You can see this here: https://heartsideb.sg-host.com/event/community-meetup-at-two-beards-deli/

    There's a phone number after the map. The phone number doesn't have a link on it, it's somehow getting the link from the map.

    How can I prevent this?

    #45529
    PeterPeter
    Moderator

    Hello,

    The map and phone number elements are wrapped in an <a> tag, screenshot https://imgur.com/gyWTG1c

    You can review your code and remove the <a> tag and check the issue again.

    #45541
    Topher DeRosiaTopher DeRosia
    Participant

    Yes, I know, it's coming from the map code, and I'm asking WHY it's there. As you can see in the code above, there is no anchor tag.

    #45542
    Topher DeRosiaTopher DeRosia
    Participant

    I figured it out, it was from another part of the page.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.