Support » Fixing WordPress » Turn image caption into a link

  • Resolved sparkle92


    Hey everyone! I know similar topics have described a similar need, but they most commonly involve adding links to the captions.

    What I really need is to turn the caption itself into a link, pointing to the same URL as the image. So, whether you click the image or the caption you go to the same URL.

    I think the solution may involve hacking the gallery creation script in media.php , but I’m not that much into PHP and don’t know how exactly to do this. The images on the site are like 5000 , so adding a link to each caption isn’t an option (link stripping can be easier to shut down, but it’s not exactly what I’m after).

    If there is some kind of plugin (which I haven’t found) that would be great. If no, I’m open to your ideas. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Michael


    Forum Moderator

    how to link caption text to the link from caption image –

    building upon following article:

    possibly with this function added to functions.php of your theme:

    (not widely tested, no guarantee)

    Hey, thanks for the suggestion. Unfortunately though, that didn’t work for me. I’ve seen a similar solution while searching over the internet, but it didn’t work either. Maybe it will help that ALL of my images are in galleries (no individual ones).

    You can see better what I’m trying to do here .

    Thank you!



    Forum Moderator

    my suggestion was aimed at individual captioned images – i didn’t fully get the idea that you are using a gallery.

    similar approach for the wordpress build-in gallery:

    css addition to keep the appearance as it is:

    .gallery-caption a { color: #444; text-decoration:none; display:block; }
    .gallery-caption a:hover { text-decoration:underline; }

    (not widely tested)

    Thank you so much! It worked. With a few tweaks on the styling I’ll get exactly what I wanted. Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Turn image caption into a link’ is closed to new replies.