WordPress.org

Forums

Adding classes to image captions (8 posts)

  1. James Wade
    Member
    Posted 2 years ago #

    Before I go ahead and put in a feature request, I thought I'd ask.

    Is there an easy way, using the interface that you can add classes to the actual image caption?

    In the "Advanced Settings" there's the option to add classes to the image or link, but not the caption itself, which strikes me as unusual.

    Am I overlooking something or does this actually not exist?

    Of course I am aware that you can edit it manually in the "text" tab, but this is a bit too confusing for some users.

  2. perthmetro
    Member
    Posted 2 years ago #

    Captions already come with their own class, i think it is .caption but don't quote me :)

  3. I'm pretty sure (I haven't looked either to double check) that it's .wp-caption and .wp-caption-text.

    If you want to play with the styling and/or options give this topic a read.

    http://wordpress.org/support/topic/css-styling-photos-and-captions-problem?replies=16

    It may help you out.

  4. perthmetro
    Member
    Posted 2 years ago #

  5. James Wade
    Member
    Posted 2 years ago #

    Perhaps I wasn't clear. Users want to add custom classes on a per caption basis.

    Here's an example:

    One caption may be green, so the class to be added will be .caption-green, or red, so .caption-red, etc.

  6. James Wade
    Member
    Posted 2 years ago #

  7. perthmetro
    Member
    Posted 2 years ago #

    Why does this need to be in the core? Why not a plugin?

  8. esmi
    Forum Moderator
    Posted 2 years ago #

    There is a certain logic to it given that you can add classes to images. But I really don't see why this can't be handed using pure CSS without any new classes. Eg:

    #attachment_1628 .wp-caption-text {
    color:red;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic