Forums

[resolved] Add 'rel="lightbox[PostID]"' to each thumbnail link in Gallery (5 posts)

  1. timtyson
    Member
    Posted 11 months ago #

    Want to alter the wp-includes -->media.php code to auto generate rel="lightbox[PostID]" when creating a gallery in a post so each image opens in a lightbox.

    Don't know ANY php, but think the line of code I need to alter is line 854:
    $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);

    I can get the rel="lightbox[PostID]" added to the img src but not the preceding a href where it must be.

    Any help from a WP php guru would be greatly appreciated and would teach me something about php!

    I always add every image on my blog individually so they open in a lightbox. I would LOVE to use the WP gallery but it does not add the rel=lightbox to the gallery code. :(

  2. timtyson
    Member
    Posted 11 months ago #

    Oh... and here's the link that shows the non lightbox gallery example:

    http://timtyson.us/archives/2011/06/a-vintage-car-mood/

  3. esmi
    Theme Diva & Forum Moderator
    Posted 11 months ago #

    Do not edit core WordPress files. I'm pretty sure there are lightbox plugins out there that hook straight into the default WP gallery.

  4. timtyson
    Member
    Posted 11 months ago #

    Thanks for the reality check!

    And I found one I'm happy with.

  5. esmi
    Theme Diva & Forum Moderator
    Posted 11 months ago #

    Excellent :-)

Reply

You must log in to post.

About this Topic