We're merging with GenerateBlocks! Learn more here.

[Support request] Excerpt length – not working

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Excerpt length – not working

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #25478

    I am setting up the plugin as explained in your documentation , but it seems that is not responding as it does not cut the excerpt at 20 words (that is what I setted up).
    See my homepage at the bottom.

    Thank you



    Are you using manual excerpts? If yes, the entry-summart will use the whole manual excerpt texts you’ve added in instead of using the set excerpt length.

    The automatic limit only applies when no manual excerpt is specified.


    Hi Elvin,
    Thanks for the explanation.
    But I doesn’t have any sense: I am using manual excerpts to control the key message on the post (I replicate it under the title as well). So, could you provide any extra code to patch the plugin? Or may be you plan to update it so far?




    Ah, I think the confusion was from the “excerpt” option not being labeled properly on WPSP.

    The excerpt length option works to the automatically created excerpts.

    It doesn’t make any sense to limit the manual excerpt because the whole point of having manual excerpt is to let the user have the full/manual control of how many words the user types in as an excerpt. That includes the punctuations and the ellipsis.

    Else, let WordPress create excerpts automatically so the limit works.


    Thanks for the answer.

    I am currently using manual excerpts to control what should it be included in the excerpt itself rather to let WordPress pick the initial paragraph to do so.
    From this point of view, that does NOT have anything to do on how do I want to show the data around my website.

    If you access the homepage, it makes a lot of sense to limit the characters shown and on some other parts it is just the opposite.

    This is why I am asking to update the plugin or send me the php lines to patch it (I guess it should not be a big deal).

    So could you handle this please?


    Try this PHP snippet:

    function manual_auto_excerpt($text) {
        global $post;
        $raw_excerpt = $text;
        if ( '' == $text ) {
            $text = get_the_content('');
            $text = strip_shortcodes( $text );
            $text = apply_filters('the_content', $text);
            $text = str_replace(']]>', ']]>', $text);
        $text = strip_tags($text);
        /*** Change the excerpt words length. If you like. ***/
        $excerpt_length = apply_filters('excerpt_length', 30);
        /*** Change the Excerpt ending. If you like. ***/
        $excerpt_end = ' <a href="'. get_permalink($post->ID) . '">' . '&raquo; Continue Reading.' . '</a>'; 
        $excerpt_more = apply_filters('excerpt_more', ' ' . $excerpt_end);
        $text = wp_trim_words( $text, $excerpt_length, $excerpt_more ); 
        return apply_filters('wp_trim_excerpt', $text, $raw_excerpt); 
    add_filter('get_the_excerpt', 'manual_auto_excerpt', 5);

    This snippet lets the plugin’s excerpt limit to control the manual excerpt as well.

    Here’s how to add PHP – https://docs.generatepress.com/article/adding-php/

    As for applying it to the official plugin, we’ll see what we can do about it.


    Works flawlessly.

    Thank you!

    Note: In Generatepress you have that option (for the blogroll only) in Customize > Layout > Blog > Content. And is super handy!


    Glad it works for you. No problem. 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.