How to pass Map Id along with post id to a listing page

Hoping to ping @VeBailovity on this. We're trying to have a map object open in a lightbox on a listing page. We're using a custom post type for a detail page for hotel, then pulling an excerpt, thumb (and theoretically map) onto a listing page. On that listing page I want to have 'view on map', and have that open in a lightbox without leaving that page. I'm thinking since post Id is present, and i've checked 'associated with this post' in the map, that the map id should also be present. Wondering how/where they're connected, and if there's some global function i can call. Would you be willing to help me out on this? We are really tricking out your awesome plugin and would be happy for you to showcase it anyway you like :slight_smile: Thanks!

  • Vladislav

    Hi,

    If the map is auto-created (from one of your custom fields), then it can be displayed automatically, together with the post. However, since you want it in a separate lightbox popup, it's probably better to insert it manually, using a shortcode and wrapped in some markup (say, a hidden DIV). The idea behind this would be to leave the plugin to render the map in the hidden div, then when an user clicks the "view on map" link, to open the hidden div in the lightbox popup. Of course, this would also require a few lines of javascript, to bind your lightbox to link click event.

    This is, of course, just an idea, and might work well if you only have one such occasion. For multiple occasions scenario, I think you might be better off letting the machine do the manual work for you. The idea here would be similar to the previous one, with one extra step - you can bind a content filter for your post type and in the processing function you can check if there are any associated maps with the post. If there are, you append the hidden div and the map markup (you can use the methods from the plugin marker replacer class) to content automatically. The end result should be pretty similar to the previous, manual idea.

  • 3SixtyEvolve

    Hope you're well @jjsararas.

    I'm just quickly checking in to see if there is anything else that we can assist with. Did you get sorted with the advice of Ve or are there still issues outstanding that needs to be addressed?

    Since we haven't heard back from you with an update, I will go ahead and resolve this topic, but please don't hesitate to reopen it should you still require additional support from us. Just select the 'Mark as Not Resolved (re-open)' box below the post area (otherwise we might miss your new post).

    Have a good day!

    Gina

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.