23 Responses

  1. Pothi
    Pothi July 2, 2011 at 12:53 am |

    I never knew these info (except for image caption :) ). Thanks for the details.

    Reply
  2. Weekly WordPress Review » WPCanada
  3. Paul
    Paul July 3, 2011 at 3:53 pm |

    Thanks a lot for the code to remove the 10px injected by wordpress.

    as for the HTML5′s “ tag, should this be done by core ?

    Reply
    1. simonlawrence
      simonlawrence July 8, 2011 at 6:37 am |

      It could be a while before HTML5 is completely integrated into core. I see no harm in theme developers adding it in where possible now, I’m going to tweak Justin’s function and use it in all my teams until WordPress catches up.

      Reply
  4. Erlend Sogge Heggen
    Erlend Sogge Heggen July 3, 2011 at 7:00 pm |

    Very handy!

    Do you know anything about captions and SEO? I would imagine search engines might appreciate that type of extra description to identify content.

    Reply
  5. WordPress 3.2 | WordPress-Buch
    WordPress 3.2 | WordPress-Buch July 5, 2011 at 7:47 am |
  6. vayu
    vayu July 5, 2011 at 9:13 am |

    Very informative – thanks Justin. :-)

    I was wondering which code syntax highlighter you use on this site?

    Vayu

    Reply
  7. Matteo
    Matteo July 6, 2011 at 11:27 am |

    Hi there, I have a problem with my captions and you can maybe help.

    whenever I’m adding captions to my images, WP incapsulate them in a div that looks like this:

    All my images are uploaded at maximum resolution and then scaled down with different stylesheets according to screen size but the caption always takes the width of the original picture.

    How can I overcome this?

    I obtained a few results by imposing an !important declaration on the various stylesheets but this is not ideal as pictures might have different widths and I would have to rethink the entire layout which is otherwise fine without captions.

    Setting manually the width to auto not only is not recommended but it won’t work either!

    Regards,

    Matteo

    Reply
  8. simonlawrence
    simonlawrence July 8, 2011 at 6:41 am |

    Justin, I tried your video caption code but WordPress removed the caption when switching between the visual and HTML editor, or saving when in the visual editor.

    Reply
  9. Fluid Images with Captions | Philip Walton
  10. Loren Swendsen
    Loren Swendsen July 23, 2011 at 5:11 pm |

    Hey just a quick word to say thanks for this tutorial! The extra 10px added by the caption shortcode had indeed plagued me on a couple past projects. I really appreciate your solution.

    Reply
  11. Maura McGurk
    Maura McGurk September 4, 2011 at 6:26 pm |

    Thanks for explaining more about captions. Do you have a solution for coding “hard returns” into a captions, so that I can break the line where I want, rather than just rely on the text wrap? I’ve been pulling my hair out all day over this one–thanks in advance for your advice.

    Reply
  12. Tushar
    Tushar December 26, 2011 at 12:16 am |

    I am using Alltuts wordpress theme for my website. When i set caption to any image it does not shown at all. even that image cannot locate at center with caption. Please help me, is there any need to do with my theme CSS?

    Reply
  13. Charley
    Charley January 2, 2012 at 9:35 pm |

    I’m trying to get my TinyMCE/visual editor to display exactly like my front-end site. I’ve removed the 10px with this tutorial for the front-end. How do I remove it on the TinyMCE/visual editor?

    Reply
  14. TODO List | Sune Frederiksen
    TODO List | Sune Frederiksen April 11, 2012 at 2:12 pm |
  15. jim
    jim June 9, 2012 at 1:40 pm |

    Thanks a lot for posting this. I’ve had this really bizarre problem with WP eating my caption tags and not displaying them correctly, including converting them to unqualified div tags as above. I think your module plus the suggestion for converting them to straight-up html5 figure and figcaption tags is a much more elegant solution. Namaste!

    Reply
  16. Tech Notes: WordPress Featured Images with Captions - Oikos
  17. Jay
    Jay August 28, 2012 at 2:02 pm |

    How do you modify the image if it doesn’t have a caption? I’d like to wrap the image/linked image in a div if there is no caption.

    Reply
  18. pinkocrat
    pinkocrat December 6, 2012 at 4:44 pm |

    Thanks Justin! Big help.

    Reply
  19. Craig
    Craig January 25, 2013 at 4:00 am |

    Great tutorial, thank you, it has proven useful. I discovered it through the Roots theme, which adds the as you suggested.

    I’m currently trying unsuccessfully to add the description field into your code, I want both the caption and the image description to show. But being no code fundi, it’s a struggle.

    Reply
  20. WordPress [caption] 多出来10px的问题 – 木瓜园

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.