Events+ [eab_events_map] shortcode

In the events in my site, I've used the [eab_events_map] shortcode in the sidebar of Upfront. Previously, it used to show the event location which I'm currently viewing. For example, if I'm viewing event A, the [eab_events_map] would show me the location of event A. But for some time now, it is showing a specific event from the site in all event pages. It doesn't show the event location that I'm viewing, neither any other events, just that specific event location on the map. I just want to show the location map of the current event that I'm viewing in the sidebar, is there any workaround for that?

  • Predrag Dubajic
    • Support

    Hi Matthew,

    Hope you're doing well :slight_smile:

    I must say that I'm a bit confused by the chat and the ticket content so could you elaborate couple of things for me please.

    As it's mentioned in ticket you are trying to use [eab_events_map] shortcode in sidebar but it shows the list of the events.
    This is actually correct behavior as it's supposed to show a map of all of your events.

    Now, I did see in chat that you actually mentioned [map id="1"] shortcode as well, and that the incorrect map was used on the event even though the map with correct ID was used.
    If I understand correctly this is the issue we should be focusing here as the [eab_events_map] doesn't show one event only, am I on the right path here?

    About [map id="1"] issue, if you're using this in a separate element inside single event you need to make sure that when you're saving changes you save them for that post only once prompted by popup.
    Since this field is applied to all event posts if you save the changes to all posts then all events will get the map with the same ID.
    But if you save for that post only then it will use that ID only for that event and that way you can have different map on each event.

    So, could you give me a bit more info how exactly were you adding the map to your events and which shortcode you want to use now?

    Best regards,

  • Matthew Hartnet
    • Site Builder, Child of Zeus

    Thanks for the answer, and it makes sense and is what I expected.

    As it's mentioned in ticket you are trying to use [eab_events_map] shortcode in sidebar but it shows the list of the events.
    This is actually correct behavior as it's supposed to show a map of all of your events.

    This answers my question.

    In an ideal world id like the map to be in the sidebar instead of below the post data. Is this possible?

    Kind regards

  • Predrag Dubajic
    • Support

    Hi Matt,

    Well, unfortunately there's no way to move that field in the plugin or Upfront, but what we can do is apply a small jquery script that will move the map to the place we want it.

    Here are the steps required to do that.
    First thing we need is a section where we will move the map to, and we need to create it from Upfront.
    So go to any event post and fire up Upfront editor.
    Now in the sidebar or wherever you want the map to show add a text element and remove all the text from it so it's an empty one.
    Go to that element settings and create a new preset:

    Name it mapHolder, this will be the class used in code so if you use different name you'll need to change in the below code.

    Once that's done save the settings for all posts of that type.

    Now we have the empty section where we want the map to show and we need to move it with jQuery.
    You will need to create a mu-plugin to do that.
    You can do this by going to your files via FTP or cPanel and inside wp-content folder create mu-plugins folder.
    In that new folder create new .php file, name it whatever you want, for example move-map-to-side.php

    Edit that file and paste this code inside:

    function move_map_to_side() { ?>
    <script type="text/javascript">
    	jQuery( document ).ready(function() {
    	    jQuery("#wpmudevevents-map").appendTo(".mapholder .plain-text-container");
    <?php }
    add_action( 'wp_footer', 'move_map_to_side');

    Save the file and that should be it, since the file is in mu-plugins folder it will always active and there's no additional actions needed for code to be active.
    So check your single event page now and you should see that the map is moved to your new section.

    Hope this does the trick for you.

    Best regards.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.