• I’ve changed my homepage from the_content to the_excerpt to show only a synopsis of the articles on the first page. I’ve also installed the the_excerpt_reloaded plugin to allow my images to be included in these synopses.

    The problem I now have is that the-excerpt-reloaded seems to fall over when encountering wordpress’s [caption] tags around images. The code appears as text in the post rather than being interpreted as it should be.

    Is there a way so strip out or ignore these tags in my excerpts (ignoring anything in [] brackets would be fantastic if that’s possible?

    The other alternative of course, would be if there’s another way to display images in my excerpts other than the_excerpt_reloaded.

    Any help greatly appreciated…
    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • I solved this by adding this:

    // get rid of the [caption]s
    $text = preg_replace( ‘|\[(.+?)\](.+?\[/\\1\])?|s’, ”, $text );

    around L102 of the-excerpt-reloaded.php, before the line if($excerpt_length < 0) {

    Chris

    Cool…

    This is the most useful think that I founded for the excerpt function.
    Can you explain it just for understand it more well?

    PS.: I place it on L129/131 replacing $text with $output

    Marco

    cabraham ‘s code also works finely with wp-limit-posts-automatically.php

    (wp-limit-posts-automatically.php is an excerpt tool to limit automatically posts without more tag)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Stripping out [caption] tags?’ is closed to new replies.