How To Add A Caption To Your Photos In WordPress

It’s been at least, oh I don’t know, maybe three people who have asked me how this can be done.

First, I find it best to resize the image to the size you want it before uploading then it’s easier to work with.

Then to add a caption I usually like to add a CSS class and wrap a div around the photo to style it. If that sounds like gibberish then you could just try something like the following code in the HTML part tab of the visual editor:

test code

After each photo. This makes the text 90% of the standard size, in italics and grey/gray.

If you wanted to do this the CSS way, you would add something like this to your themes style.css

.photocaption {
font-size: 90%;
font-style: italic;
color: #999999;
}

Then in a post would write this:

Caption text here

The text would then be styled as before. Notice the “hard return” before the caption text i.e. it starts on a new line, otherwise the caption text would start next to the photo and not below it. It is possible to automatically wrap text at a certain width, but let’s not confuse matters.

You could of course also set a background colour, float the image right or left and many other things.

Hope that hasn’t confused you too much!

10 thoughts on “How To Add A Caption To Your Photos In WordPress”

  1. Thanks Muhammad. If you have AWeber it’s simple to check your list by logging in and looking at your subscriber information in Reports.

  2. I have added the subscribe option provided by your site successfully. now i want to know that how could i check my subscribers list. i want to check whom subsribe to my blog.

  3. I have added the subscribe option provided by your site successfully. now i want to know that how could i check my subscribers list. i want to check whom subsribe to my blog.

  4. I used the CSS version, but put the style on a span tag, inside the p with the image. 😉

    By the way… what are you using the display code? Is it a plugin? I use a Google tool, but it’s kind of slow.

  5. I used the CSS version, but put the style on a span tag, inside the p with the image. 😉

    By the way… what are you using the display code? Is it a plugin? I use a Google tool, but it’s kind of slow.

Leave a Reply

%d bloggers like this: