Viewing 6 replies - 1 through 6 (of 6 total)
  • 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

    Thread Starter fegi

    (@fegi)

    Thank u!

    When you come in Croatia you have botle of our wine 🙂

    Plugin Author Ian Dunn

    (@iandunn)

    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?

    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

    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 ?

    Plugin Author Ian Dunn

    (@iandunn)

    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 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Lightbox 2 don't work with BGMP’ is closed to new replies.