• I’ve built a custom post type and created a tabular display using Types and Views, and am using Pronamic Google Maps to collect geocoordinates and associate them with each custom post. Is there a way to make it so that the map (embedded using the googlemapsmashup shortcode) only displays markers for the currently displayed custom posts, so that when I filter the table’s results, the map’s results are filtered in the same way?

    Here’s the custom display I’m referring to, with the map embedded at the bottom.

    Thank you!

    https://wordpress.org/plugins/pronamic-google-maps/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Reüel

    (@pronamic_reuel)

    Instead of using the shortcode, you could use the pronamic_google_maps_mashup function in your template and pass the IDs of the posts, like this:

    <?php
    pronamic_google_maps_mashup(
    	array(
    		'post__in' => array( 1, 2, 3 ),
    	),
    	array(
    		'width'       => 600,
    		'height'      => 600,
    	)
    );
    ?>
    Thread Starter rbrazell

    (@rbrazell)

    Wouldn’t that hard-code certain posts into the map display, though? I want the map display to dynamically update when the filters are changed, and I don’t have any way to predict which combination of filters a visitor will use. I need a way to have the plugin 1) determine what is being currently displayed on the page, and 2) display those same posts on the map.

    Plugin Author Reüel

    (@pronamic_reuel)

    The filters on the page require a page refresh, so there should be a way to get the IDs of the displayed posts during page load. These are the IDs you need to dynamically insert in the pronamic_google_maps_mashup function. So it’s not hard-coding the IDs but rather getting the IDs of the displayed filtered posts. Unfortunately, I don’t know how this filtering is done exactly and as such cannot help you getting the IDs. My starting point would be the documentation of the used filtering plugin 🙂

    Thread Starter rbrazell

    (@rbrazell)

    Gotcha — thanks for clarifying. I appreciate your pointing me in the right direction! I’ll circle back and update this once I’ve found a resolution in case others are trying to do the same thing.

    Plugin Author Reüel

    (@pronamic_reuel)

    You’re welcome! Please let us know if you we’re able to solve this.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘limit markers to current results?’ is closed to new replies.