WordPress.org

Ideas

Add image Caption hook

  1. guillaumemolter
    Inactive

    There is currently no proper way to hook into image captions.

    Image captions are stored into the excerpt of attachments posts but when the caption is retrieved it doesn't go threw any specific filter to globally add extra formatting or enable short-codes.

    I think it would be nice to have a add_filter ( 'image_caption', 'your_filter' ); or something similar.

    What do you think?

    Posted: 4 years ago #
  2. Captions are nested in a shortcode already, so it's always been a bit janky to do that.

    What kind of formatting are you talking about though? That should already be doable with CSS.

    Posted: 4 years ago #
  3. rmughal
    Member

    +1 for the idea!

    That would be a nice idea, though I don't use captions a lot, but I see how lots of people will benefit. Its not just about modifying the looks through css, but actual content using a filter as op mentioned.

    Posted: 4 years ago #
  4. guillaumemolter
    Inactive

    @rmughal: you should vote/rate it then ;-)

    @ipstenu: Captions on single images are nested but not for galleries. Many image sliders and image related plugins also use captions in different ways. I'm was not necessarily talking about style formatting, I was thinking more in term of dynamically adding/appending/prepending/removing content to the caption on display (i.e: adding "New:" in front of the caption for a picture that was posted less than a week ago)...but even with style formatting, a lot of Dev relies on conditional CSS classes for styling and WP short-codes are often used for that...

    Posted: 4 years ago #
  5. HUH! That is an interesting idea! Thank you for elaborating!

    Posted: 4 years ago #
  6. I like the idea too!

    I want to rate for it but thats not possible with Chrome, even when i agree "unsecure scripts"...

    Posted: 4 years ago #
  7. Drew Jaynes
    Inactive

    12345

    I think this might make an interesting proposal for core inclusion. If someone is interested in pushing it further, I would encourage them to create a new enhancement ticket on Core Trac.

    Posted: 4 years ago #
  8. guillaumemolter
    Inactive

    @Drew Jaynes: Ok thank you I'll look into it tomorrow. I'll also look how I can potentially contribute to it too :-)

    Posted: 4 years ago #
  9. Benji Mauer
    Member

    Plus 1 on this functionality. Also, relatedly I strongly support adding the size class of the contained image to the figure container.

    Posted: 2 years ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    2 Votes
  • Status

    This idea is under consideration