The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Basic Google Maps Placemarks
Lightbox 2 don't work with BGMP (7 posts)

  1. fegi
    Posted 3 years ago #


    Whan I have BGMP in post then lightbox 2 don't work...
    Can I do something with BGMP script to solve these?


  2. FranceImage
    Posted 3 years ago #

    Hi fegi,

    I had a look at the code and found where it's going wrong.

    In file core.php you have to comment out line 1261 (last version of the plugin)

    // 'details' => apply_filters( 'the_content', $pp->post_content ),

    The lighbox will work again.

    Note to the author: This apply_filters() calls lightbox hook with the content of the map custom post and after that, lightbox hook is not called with the content of the current post (so lightbox cannot insert the rel=lightbox attribute in the img elements)

    Hope this helps

  3. fegi
    Posted 3 years ago #

    Thank u!

    When you come in Croatia you have botle of our wine :)

  4. Ian Dunn
    Plugin Author

    Posted 3 years ago #

    FranceImage, thanks for looking into it. Are you referring to WP Lightbox 2? I don't see anything in their the_content callback function -- jqlb_autoexpand_rel_wlightbox() -- that would prevent it from running because it was called by another plugin.

    Can you tell me which file and line number in the plugin you're referring to?

  5. FranceImage
    Posted 3 years ago #

    Hi Ian,

    You're exactly at the right place (line 157 of the wp-lightbox-2.php file.

    The jqlb_autoexpand_rel_wlightbox() receives an empty $content when your plugin is active.

    With the debugger I also noticed that the callback is not called for the post that contain the image but only for the placemark custom post.

    I have never used the apply_filters() function in this context, so I don't know how to interpret this behaviour.


  6. FranceImage
    Posted 3 years ago #

    Hi again,

    I think I found an explanation and a workaround.

    You use apply_filters('the_content') to populate your $placemark variable.
    This is happening when you execute your shortcode callback; at this time your are already in another apply_filters('the_content') call.

    apply_filters is not recursive and the second call messes up some global variables

    global $wp_filter, $merged_filters, $wp_current_filter;

    A solution (I tested) would be to save this global variables before your apply_filters('the_content') call and restore them after (like here)

    Does it make sense ?

  7. Ian Dunn
    Plugin Author

    Posted 3 years ago #

    Yeah, that does make sense. Thanks for digging into it. I'll work on implementing that fix and getting it into the next release.

    Thanks for your help :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.