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