<?php
/** be sure your link has a data-id attribute with the postid and a data-lat attribute with the latitude
**/
add_action( 'wp_head', function() { ?>
<script>
(function($) {
$( 'body' ).on( 'click', '.post-item', function(e) {
e.preventDefault(); // Necessary if '.post-item' is an <a> tag and you don't want it to open the post page itself.
var postid = $(this).attr('data-id');
var postlat = $(this).attr('data-lat'); // add a data-lat to the <a> tag with the location's latitude value
var marker = FWP_MAP.get_post_markers(postid);
$.each( marker, function( key, value ) {
if ( value.position.lat() == postlat ) {
FWP_MAP.map.setCenter({
lat: value.position.lat(),
lng: value.position.lng()
});
FWP_MAP.is_zooming = true; // Needed if you are using the "Enable map filtering" button
FWP_MAP.map.setZoom(17); // Set a zoom level between 1 and 20. Make sure it is higher than the marker clusterer's bottom limit.
// google.maps.event.trigger(value, 'click'); // If you don't have spiderfied markers
google.maps.event.trigger(value, 'spider_click'); // If you have spiderfied markers. Will also work if you don't have spiderfied markers.
}
});
});
})(jQuery);
</script>
<?php } );