WordPress.org

Ready to get started?Download WordPress

Forums

Adding classes to image captions (8 posts)

  1. jpswade
    Member
    Posted 7 months 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. Pete
    Member
    Posted 7 months 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. Pete
    Member
    Posted 7 months ago #

  5. jpswade
    Member
    Posted 7 months 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. jpswade
    Member
    Posted 7 months ago #

  7. Pete
    Member
    Posted 7 months ago #

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

  8. esmi
    Theme Diva & Forum Moderator
    Posted 7 months 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;
    }

Reply

You must log in to post.

About this Topic