Also, do you flush rewrite rules after registering the customer locations posttype?
I kept getting 404 error on the location custom posts, which was fixed after I went to the Permalinks settings page and Saved again. (without changing anything)
RE: loading ajax posts below the map:
That’s a little outside the scope of the plugin, but you can pull that in yourself.
In v1.1.4, I’ve added the post ID to the marker click callback function:
wpsl_click_marker(marker, i, active_form, post_id)
So, you could trigger an ajax load inside that function and pass the post_id parameter to specify which post to grab.
RE: flush rewrites:
Rewrites were being flushed, but not when updating the ‘locations’ type/label. That’s been added in v1.1.4
Hi Kyle,
Thanks for adding the callback!
I am having trouble hooking into it though. I’ve created a global function wpsl_click_marker(marker, i, active_form){} function, but I’ve got the feeling I use wp_enqueue_script wrongly, since the function isn’t being triggered.
Sorry that this question has to do with WP itself. 🙂
Sorry for the late reply. You may want to ensure the plugin scripts are loaded and available for your custom scripts. Try adding the plugin scripts as a dependency when you enqueue your custom scripts:
wp_enqueue_script('your-script-name', '/path-to-your-script', array('simple-locator'),
'version');
For those interested this code will scroll to the corresponding result when marker is clicked. It is important to understand that you need to add the post_id as an id on your <li> if you want the code to work.
function wpsl_click_marker(marker, i, active_form, post_id){
var anchor = $('#' + post_id);
$('html,body').animate({
scrollTop: anchor.offset().top
}, 600, 'swing' ); // here you can change the speed and the type of animation you need.
}