WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Clustering only on one map (using shortcode for ex.)

[Resolved] Clustering only on one map (using shortcode for ex.)

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Ian Dunn
    Participant

    @iandunn

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

    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!

    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!

    Plugin Author Ian Dunn
    Participant

    @iandunn

    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.

    Wow, thank you very much Ian!

    This is exactly what I needed 🙂

    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?

    nobody knows, nobody tried?

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Clustering only on one map (using shortcode for ex.)’ is closed to new replies.