Linked picture captions

I’m really enjoying using WordPress as a content management system as well as a blogging platform, but as with anything there will always be the odd thing that you don’t like or wish had been implemented differently. When trying to do the post for my media I came across a slight snag; I couldn’t get the picture caption to link to the source. After looking it up online I discovered that it wasn’t just me, it’s the way WordPress works.

I tried to manually link a word in the HTML viewer; however I found that when I saved the post the link was stripped out. After some quick researching [Google to the rescue] I found that it is to do with the way the caption is programmed. All the caption text is held within double quotes, and WordPress will strip out any code within these double quotes.

Simple solution? Make sure you’re in the HTML editor, change the double quotes to single and put the link in manually around the word you want linking. Save the draft and preview. It works… however, if you go back to edit the blog post and use the visual editor then it will change the quotes back to double and strip the link out. This is very irritating. I have not managed to find an easy solution for this, as long as I edit the article in the HTML editor only then it’s fine… Not the nicest solution ever but at least I could put the credit in.

Apparently there are many plug-ins which claim to fix this. They tend to add code to the functions file, however a lot of these do not work / are hard to set up or require you to use syntax which changes the image alt text to match the caption, which is not necessarily something you want to do. It looks like WordPress will be addressing the problem in future versions but that doesn’t help much right now.

Another site suggested not using the built-in picture captions and instead creating a ‘caption’ style for a paragraph in the stylesheet and using that paragraph style instead. This looks like a better solution as long as you know what you’re doing with CSS… [I liked the built in caption style so I’ll be sticking to the HTML way of doing things].

If anyone has a better solution I’d love to hear about it :-)

2 thoughts on “Linked picture captions

  1. Frances Bell says:

    I am not an HTML programmer so can’t analyse this in detail but I can tell you how I usually put my images in my blog posts. The images I use are either my own (on flickr) or I search for CCL content. I have linked my flickr account to my WordPress blog so when I find the image I want to use, I just use the share option from flickr and hey presto the start of my blog is done – I just have to add the text;).
    Here’s an example I did recently for a demo for a colleague
    and here is the underlying code

    Schnuffel, a photo by amonja on Flickr.

    Don’t know if that helps.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>