• I use Twenty Twelve 1.5 and WordPress 4.0. I created child theme.

    I edit content.php to make my entry showing excerpt 40 words for normal post and 65 words for sticky post. So I use wp_trim_words

    This is the code,

    <div class="entry-summary">
    <?php
    $content = get_the_content();
    $trimmed_content = wp_trim_words( $content, 40, '...<div class="readmoretag"><a href="'. get_permalink() .'">continue reading</a></div>' );
    echo $trimmed_content;
    ?>
    </div><!-- .entry-summary -->

    But now my website is showing [caption] because in my post, I put image with caption in the first paragraph.

    How can I remove the caption and only show text paragraph on the excerpt?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter karkunum

    (@karkunum)

    Can anybody help me with this? I think this is a very serious thing. If it cannot be done, its a big flaw on WordPress.
    My url is https://demo.teknokrati.com/

    You can see the first normal post (not the featured sticky post) has a [caption etc….. in the first summary. That is because in the post I have image with caption.

    Got the same error. Anybody can help?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove [caption] from wp_trim_words’ is closed to new replies.