WordPress.org

Ready to get started?Download WordPress

Forums

Can thumbs in Gallery shortcode link to Post they're used in, not the attachment (1 post)

  1. Dan
    Member
    Posted 1 year ago #

    Just a disclaimer, I understand the difference between link="file" and link="post".

    I would like the thumbnails in the default gallery shortcode to link to the blog post they're used in rather than the image's attachment page.

    Here's an example...
    http://www.troylaundry.com/portfolio/

    And the code is...
    [gallery link="post" ids="106,107,133"]

    Those 3 images are attached to their own blog posts (Posts > Add New) and are Featured Images respectively (not Insert Into Post). And by "attached" I mean, in the Media > Library panel I have specifically clicked "Attach" and selected the appropriate blog post.

    As you can see, they link to what I believe is called the "attachment page" in WordPress-speak. I'd like to have it link to their blog post, not that attachment page.

    I feel this can be done because it has the slug to the blog post in the link, but is also appending the slug to the attachment page...

    http://www.troylaundry.com/bathroom-of-an-abandoned-mineral-spa-at-the-salton-sea/mineral-spa-bathroom-salton-sea/

    But I'd rather it simply link to...
    http://www.troylaundry.com/bathroom-of-an-abandoned-mineral-spa-at-the-salton-sea/

    I've tried NextGen Gallery and WP Gallery Custom Links but would love to achieve this without them if possible.

    Many many thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic