WordPress.org

Forums

Basic Google Maps Placemarks
[resolved] Clustering only on one map (using shortcode for ex.) (9 posts)

  1. BigBelly
    Member
    Posted 1 year ago #

    Is it possible to allow clustering only on one single map with other maps without clustering?

    i.e. in shortcode or php code?

    Thank you!

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

  2. Ian Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, you can use the bgmp_map-options filter to control any of the options dynamically.

  3. BigBelly
    Member
    Posted 1 year ago #

    Awesome!

    But could you please please please tell me how to do it? :) I need just to enable clustering on a single map, globaly it will be disabled.

    I tried to find it but haven't been successful :(

    TY!

  4. BigBelly
    Member
    Posted 1 year ago #

    I'm sorry, I really tried to find out, how to use that bgmp_map-options filter you mentioned, but I dunno how at all :(

    Could anybody please help me with that?

    Thank you very much!

  5. Ian Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    There's a lot of information in the Codex and elsewhere online about how to work with WordPress filters. It'd look something like this:

    function modify_bgmp_options( $options ) {
        $post = get_post();
    
        if ( 5 == $post->id ) {  // where 5 is the id of the page containing the map
            $options['clustering']['enabled'] = true;
        }
    
        return $options;
    }
    add_filter( 'bgmp_map-options', 'modify_bgmp'options' );

    You'll probably need to modify that a bit to make it work for you, but that's the gist of it. You can look inside the getMapOptions() function in core.php to see the structure of the options array.

  6. BigBelly
    Member
    Posted 1 year ago #

    Wow, thank you very much Ian!

    This is exactly what I needed :-)

  7. BigBelly
    Member
    Posted 1 year ago #

    Ian,

    I tried your code, modified it and it seems that enabling clustering via filters doesnt work :-(

    I tried to set other options via filters (both regular like zoom, lat, map type etc. and also options from clustering array like cluster style etc) and everything works like a charm but enabling clustering - map doesnt react on that at all.

    Is it really working?

  8. BigBelly
    Member
    Posted 1 year ago #

    nobody knows, nobody tried?

  9. BigBelly
    Member
    Posted 1 year ago #

    Dunno why but after updating to newest version of WP it suddenly works :D Thank you Ian for your support!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic