• jeroen8484

    (@jeroen8484)


    Hi Kyle,

    Would it be possible to show the location custom posts using ajax below the map? So when you’d click on a marker in the map, the detailed location info is shown below?

    If I’m able to do that with this plugin, I’ll translate the plugin to Dutch for you. ??

    Kind regards,
    Jeroen

    https://www.ads-software.com/plugins/simple-locator/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter jeroen8484

    (@jeroen8484)

    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)

    Plugin Author Kyle Phillips

    (@kylephillips)

    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

    Thread Starter jeroen8484

    (@jeroen8484)

    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. ??

    Plugin Author Kyle Phillips

    (@kylephillips)

    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.
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Location posts on result page’ is closed to new replies.