WordPress.org

Support

Support » Plugins and Hacks » WP jQuery Lightbox » [Resolved] [Plugin: WP jQuery Lightbox] No auto-lightboxing for gallery link in template

[Resolved] [Plugin: WP jQuery Lightbox] No auto-lightboxing for gallery link in template

  • Hi,

    I’m having trouble getting auto-lightboxing on this line of code in my template:

    <?php echo do_shortcode('[gallery columns="4" link="file"]'); ?>

    It just links to the file with no lightbox. If I click on the image in its attachment page it WILL lightbox, so something is working (just not this gallery).

    Any ideas? Thanks,

    http://wordpress.org/extend/plugins/wp-jquery-lightbox/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author ulfben

    @ulfben

    Link to the template page please.

    Plugin Author ulfben

    @ulfben

    You could try:

    jqlb_apply_lightbox(do_shortcode('[gallery columns="4" link="file"]'), "any ID");

    Sorry to revive a really old thread, but I am having the same problem. That last code you posted work. However instead of taking the post ID as a rel (rel="lightbox[86]") it prints out some large integer (rel="lightbox[134181907414754]").

    I’ll have a look some more for a solution but if you know what’s up with that really large number and already have a solution, let me know 🙂

    EDIT:

    I should’ve really tried this fix before posting above, but the fix is to change some lines in wp-jquery-lightbox/wp-jquery-lightbox.php (Installed plugins -> jQuery Lightbox -> Edit -> first file on the list)

    1. Search for function jqlb_do_regexp($content, $id)
    2. Add global $post after the first curly bracket (before $id = blah)
    3. Change $replacement = '$1 rel="lightbox['.$id.']">'; to $replacement = '$1 rel="lightbox['.$post->ID.']">';

    Note that the above fix is not endorsed by the creator (yet) and usage testing is extremely limited to my case.

    Plugin Author ulfben

    @ulfben

    All the lightboxing functions expects two parameters – the content (HTML markup) to box, and an ID for the set. The ID can be anything – jqlb_autoexpand_rel_wlightbox (= the automatic shortcode handler) uses the post ID whereas the jqlb_apply_lightbox (= the public method you’re using) falls back to a random number.

    Ergo: when you’re calling the functions yourself, you’re supposed to provide an ID for your sets. If you want it to use the post ID, give it the post id. There’s no need to alter the plugin source.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [Plugin: WP jQuery Lightbox] No auto-lightboxing for gallery link in template’ is closed to new replies.
Skip to toolbar