WordPress.org

Ready to get started?Download WordPress

Forums

Basic Google Maps Placemarks
[resolved] Go to top (5 posts)

  1. aj_partner
    Member
    Posted 1 year ago #

    I would appreciate anyone who might be able to help with a small bit of code. I am using the view on map shortcode but I have a list of over 80 placemarks. When the view on map link is clicked it works properly but if the user has scrolled down the page viewing the list the actual map is no longer visible.

    Is there a way to add something in the view function to force the page to go to the top when the view on map link is clicked?

    I'm assuming some code can be added to:

    basic-google-maps-placemarks/views/shortcode-bgmp-list-marker.php

    Anyone have suggestions? Thanks in advance for your help. (Apologies if this has been covered anywhere previously, I looked but did not find the same question / request. If it has, please direct me.)

    My map and list can be viewed:

    HCMC Map

    I am using the Weaver 2.2.9 theme currently.

    The map page at the link above is using the two shortcodes of:

    [bgmp-map]
    [bgmp-list viewonmap="true"]

    http://wordpress.org/plugins/basic-google-maps-placemarks/

  2. Ian Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    Hi, that functionality is already built into BGMP, but it's disabled by default. You can enable it by using the bgmp_map-options filter.

    function set_bgmp_map_options( $options ) {
        $options['viewOnMapScroll'] = true;
        return $options;
    }
    add_filter( 'bgmp_map-options', 'set_bgmp_map_options' );
  3. Gillian
    Member
    Posted 1 year ago #

    Hi Ian

    That's wonderful - I had the same issue on my maps and adding this functionality has solved it perfectly! Thank you for making it available.

    To easily add the filter without having to create a child theme I used this plugin from another of my favourite plugin authors :-)
    Add Actions and Filters

  4. aj_partner
    Member
    Posted 1 year ago #

    Excellent - works perfect - thanks Ian and Gillian - used both your code and plugin respectively.

  5. aj_partner
    Member
    Posted 1 year ago #

    Resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags