I had a lot of issues with it. Here’s what appears to be happening:
Buddypress is escaping the &&
in the JavaScript code.
I only got that to work if I enabled shortcodes in the buddypress activities; like so:
// Enable Shortcodes for Side-wide Activity Stream
function leaflet_add_shortcodes_to_activity_stream() {
add_filter( 'bp_get_activity_content_body', 'do_shortcode', 10 );
}
add_action('bp_init', 'leaflet_add_shortcodes_to_activity_stream');
that 10
might help you get past the escaping &&
error.
However, in my tests, I noticed it was loading via ajax, which meant that the wordpress scripts and styles weren’t queued! So I also included this in my functions.php file to force leaflet to load css and js on every page (currently it loads only if there’s a map being rendered. Kind of surprised that this hasn’t been an issue before. I suppose most people/plugins/themes aren’t getting their pages via ajax. Anyway, if you’re interested, here’s how I got the JS/CSS to queue on all pages:
function leaflet_always_enqueue_leaflet () {
include_once LEAFLET_MAP__PLUGIN_DIR . 'class.plugin-settings.php';
$settings = Leaflet_Map_Plugin_Settings::init();
$js_url = $settings->get('js_url');
$css_url = $settings->get('css_url');
wp_enqueue_style('leaflet_stylesheet', $css_url, Array(), null, false);
wp_enqueue_script('leaflet_js', $js_url, Array(), null, true);
}
add_action('leaflet_map_loaded', 'leaflet_always_enqueue_leaflet');
Hope this helps.
-
This reply was modified 6 years, 5 months ago by
bozdoz.