Forums

[resolved] the_excerpt function not showing images with captions (5 posts)

  1. dajense
    Member
    Posted 4 months ago #

    As the title says, using the_excerpt function images with no caption display fine in my overview pages. As soon as I add a caption the corresponding image disappears. I changed the word length and tried using a custom trim_excerpt function (http://aaronrussell.co.uk/legacy/improving-wordpress-the_excerpt/) without success.

    Does anybody know why this is? Is this possibly a bug?

    Thanks for your help.

  2. dajense
    Member
    Posted 4 months ago #

    Ok fixed it. Captions are shortcodes which are automagically filtered by the_excerpt ... so prevent this from happening, i.E. using the_advanced_excerpt plugin with appropriate options.

  3. esmi
    Theme Diva & Forum Moderator
    Posted 4 months ago #

    No - the_excerpt() strips out all shortcodes including those for captioned images. This is by design.

  4. dajense
    Member
    Posted 4 months ago #

    Maybe the shortcodes should disappear, I could live with that. But for me it stripped the image as well if I included a caption. Is this by design as well?

  5. alchymyth
    The Sweeper
    Posted 4 months ago #

    the_excerpt() strips all html tags, inclusive img tags, regardless if they have captions or not.

    http://codex.wordpress.org/Function_Reference/the_excerpt

Reply

You must log in to post.

About this Topic