WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. fegi
    Member
    Posted 1 year ago #

    http://www.vlakovi.com/?p=3453

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

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

  2. FranceImage
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

    Thank u!

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

  4. Ian Dunn
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Posted 1 year 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.

    Cheers

  6. FranceImage
    Member
    Posted 1 year 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
    Member
    Plugin Author

    Posted 1 year 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

Tags

No tags yet.