getting photo captions to wrap

  • Unknown's avatar

    Does anyone know how to get photo captions to “wrap”? When I include a photo with a long caption, the caption appears on a single line, and often the line is much longer than the photo is wide. So there’s a huge white space on either side of the photo, to make room for the caption. I want the caption to wrap, so that it will have multiple lines and won’t be any wider than the photo. But I can’t find any command to do that.

    Thanks!

    /David

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hello there,
    On this theme the gray caption boxes do not display, but the caption text which is automatically rendered in italics does display as normal text beneath the image. I tried it in my text blog and aligned the image to the left. I found the text wrapping in the caption did work for me. See here > http://en.support.wordpress.com/images/image-alignment/

  • Unknown's avatar

    Messed up captioned images means messed up image code: very easy to happen if you’re using the Visual editor. After inserting a captioned image, always make sure the cursor is outside the caption area before doing anything else.

  • Unknown's avatar

    Also, if you are using only the Visual Editor to write your posts, the best way to avoid problems with messed up captions is to write the entire post, placing the pictures where you want them. Once everything is written, then go back to add the captions.

  • Unknown's avatar

    Thanks, everyone, but I’m afraid I wasn’t able to make heads or tails of that advice. It looks like the instructions in timethief’s link were for making the main body text wrap around an image. I’m actually not having problems with that. My problem is that the image’s caption doesn’t wrap. Or maybe a better way to put it: the caption is all on one line, no matter how long it is–even if it’s longer than the image is wide. I’d like the caption to get broken into two lines or more if it’s wider than the image.

    I did try the suggestions in the other two answers, but they didn’t help–though I didn’t really grasp the suggestion in either answer, so I may not have made the attempt correctly.

    Anyway, I’d really like to get my captions to break into two or more lines when they’re longer than the image. Can you help?

    Thanks.

  • Unknown's avatar

    Well we did try to help!
    Captions are supposed to break into two or more lines when longer than the image. When this doesn’t happen, it means the code has been disrupted. For example, in your latest post the code of the second image is ok but the code of the first isn’t: I bet if you add more text to those two captions, the first won’t wrap and the second will. The only thing you can try after you have inserted a malfunctioning captioned image is delete the image, update the post to clean it up, then re-insert the image and update again.

  • Unknown's avatar

    Thanks, panaghiotisadam. I just tried that on a draft post, and it did correct the issue. But the caption was left-justified, and when I centered it, it fell apart again: it stopped breaking into two lines.

    How were you able to tell that the code in my post had been disrupted? Is there a more reliable way to fix it, like changing the html?

    Thanks again.

  • Unknown's avatar

    It seems that when I first insert an image into a post, the system handles the captions right: they break into two lines. But if I make any change to the image–like adding space around it or centering the caption–the caption no longer breaks into two lines.

  • Unknown's avatar

    “How were you able to tell”
    By looking at the sourcecode of your page (browser View menu > View Source).

    “But the caption was left-justified”
    Yes, that’s the way they are coded in the theme you’re using.

    “when I centered it, it fell apart again”
    Yes, that –or any other attempt to edit the caption in the visual editor– is the cause. All the attributes of the auto-inserted captions are pre-defined and non-editable. (By the way, that’s related to my initial reply above, which said: get out of the caption area before doing anything else.)

    “Is there a more reliable way to fix it, like changing the html?”
    Yes, but it’s complicated. You see, when you insert a captioned image, your HTML editor doesn’t display the actual HTML of the caption, it displays a shortcode formula (that’s what makes it non-editable).
    One way to change the HTML is to replace the formula with the actual code (copied from the sourcecode of the published post) then add extra code. Another way is to insert plain, non-captioned images, enter the caption as regular text below them, and work out all the HTML that’s needed to format them correctly (which is equally if not more complicated).
    I can help with both, if you wish, but I don’t think it’s a reasonable thing for you to do. If centered captions are important to you, I would suggest you look for a different theme instead.

  • Unknown's avatar

    Thank you, panaghiotisadam! These themes do seem to have some traps for the unwary! Anyway, it’s not the solution I’d hoped for, but it’s good to know the answer. Unfortunately, changing themes is a pain because my header is designed for that theme, and it’s a hassle to change it. I guess I can live with left-justification for my longer headers.

    Regards,

    /David

  • Unknown's avatar

    You’re welcome.

    If you’re willing to go into the trouble of modifying your occasional long captions, check this post of mine:
    http://wpbtips.wordpress.com/2011/08/01/changing-formatting-of-captions/

    Where the code says this:
    <p class="wp-caption-text">
    you’ll change it to this:
    <p style="text-align:center;" class="wp-caption-text">

  • Unknown's avatar

    Thanks again, panaghiotisadam. I think I’m going to live with the limits of my theme for now, but I really appreciate the help!

  • Unknown's avatar

    Ei Davidcarthage: Try this……when you want to break the line to create a second caption line, Press Shift + Enter. I hope it works for you dude.

  • Unknown's avatar

    That for regular text in a post, not for text inside an image caption.

  • The topic ‘getting photo captions to wrap’ is closed to new replies.