Support » Requests and Feedback » WP 2.5 Gallery – Lightbox Option?

WP 2.5 Gallery – Lightbox Option?

  • {Hmm. The drop-down selector needs tweaking to add 2.5 lol}

    I’ve just tried the new gallery option and it looks quite good. It’s a disappointment, however, after using the lovely AJAX pop-up when adding images in the editor to find there’s no option to display the galleries in a lightbox: looks like it’s back to manual edits and a plu-in for me.

    Can I ask for the option at least to include a lightbox option? Something like [ gallery display=”lightbox” ]?

Viewing 15 replies - 1 through 15 (of 16 total)
  • Yeah a built in lightbox feature would be great for the gallery instead of going to the attachment id page. I hope a plugin will change this.

    I just did a (slightly dirty) hack to get lightbox working. Havent got time to look into building it into a plugin, as Ive never written a plugin before and cant see how I could redefine this function like you can do elsewhere in WP.

    Use this at your own risk!!!

    In wp-includes/post-template.php, line 390 looks like so:

    return "<a href='$url' title='$post_title'>$link_text</a>";

    Replace this line with the following:

    //mafro lightbox mod
    list($url, $w, $h) = wp_get_attachment_image_src($id, "full", $icon);
    return "<a href='$url' title='$post_title' rel='lightbox'>$link_text</a>";

    This set the correct link for the image in link tag and add the rel=”lightbox” attribute we all know and love.

    In order for this hack to work you will also need this plugin to include lightbox:
    Lightbox 2

    Moderator Samuel Wood (Otto)


    WordPress.org Tech Dude

    The gallery code is capable of being replaced by plugins, so expect some plugins out soon that change its behavior. For example, I wrote a quick one over the weekend that displays the gallery images in a coverflow-like manner. It’s too ugly for public release yet, of course, but it’s easy enough to do that I expect several different gallery plugins will be out soon.

    The hack almost works for me. The lightbox window opens, but for some reason it is truncated (small) and does not show the image. For an example see:

    Any suggestions would be most appreciated!


    Update: the Lightview-plugin, newly updated for 2.5 works perfectly with this hack.


    Works perfect! Thanks!!

    thanks for the hack!
    also works with Slimbox Plugin

    just replace rel=’lightbox’ with rel=’lightbox[roadtrip]’

    and yes, a plugin would be cool 😉

    Thanks a lot for the hack! works beautifully..

    This plugin adds rel=”lightbox” to the new gallery feature in WP 2.5. It also adds it to all image links within posts and pages, and adds the lightbox js too (using jQuery Lightbox).

    WP 2.5 Gallery Lightbox Plugin

    This stopped working.
    And sammyb, your plugin won’t work either.
    That’s since today’s upgrade to 2.5.1

    Any ideas?

    Actually, sammyb, yours does work with the above hack. 🙂
    But I like the “Lightview Plus” plug-in better… (no offense).
    Anyone know why it’s not working now?

    I just released a plugin, gallery-plus, that can add the lightbox attribute to the gallery. You need to install the lightbox 2 plugin also. I personally use version 2.6.0.

    mafro your solution worked perfectly. exactly what I wanted to do.

    I agree! I found really weird that there is thickbox being used in the editor (when browsing media files) but yo don’t have the option to use it with the [gallery] shortcode.

    I made a feature request here:

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘WP 2.5 Gallery – Lightbox Option?’ is closed to new replies.