• I’ve got a bunch of images inserted into posts with metadata I’d like to display underneath them: some have caption, some have description, some have both.

    I’ve figured out how to filter img_caption_shortcode to display the description. The problem is that this is apparently called only when there is a caption. So if I want to display an image description under an image with no caption, this doesn’t appear to be a solution.

    What I’d like to know is how to either:

    • Hook into the inline image formatting to display exactly what I want (can’t figure this out for the life of me, have dug through all the code and don’t see where img_caption_shortcode gets auto-applied to inline images), or
    • force img_caption_shortcode to be applied to all images which have a description (regardless of whether they have captions)

    The more semantic way would definitely be the first, but either would make me happy 🙂

    To avoid the inevitable suggestions: no, I can’t change where I store the metadata, putting it all in the caption or something – there is a large number of images which woud nee to be thus edited, and an undue amount of effort would be required, besides the fact that we’re using them for two separate purposes (one is for a description, one is for copyright info); and, no, we aren’t satisfied to use shortcodes to accomplish this, as it would require going back into many posts and editing a huge amount of data, with the risk of missing some.

    (I guess it would be possible to filter the content and pull the metadata from the image within the tag, but that seems like it would be a lot messier. I’d prefer a cleaner solution if possible.)

  • The topic ‘Adding Image Description below Images Inserted into Posts’ is closed to new replies.