[Resolved] Trouble Setting the Excerpt Length

Home Forums Support [Resolved] Trouble Setting the Excerpt Length

Home Forums Support Trouble Setting the Excerpt Length

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1562505
    Anthony

    I can’t seem to get the excerpt length to be what I set it to in the Customizer > Layout > Blog settings. Not sure if something else is holding it back somewhere? I’ve shared a screenshot of my current settings and a link to my blog.

    I have tried a combination of other settings and have had no luck.

    Thanks

    #1562569
    Elvin
    Staff
    Customer Support

    Hi,

    Can you check this documentation if it is applicable?
    https://docs.generatepress.com/article/excerpt-issues/#word-count-not-working

    Let us know.

    A wise man once said:
    "Have you cleared your cache?"

    #1562576
    Anthony

    Hey, thanks!

    I’ve never used a more tag in my life haha.

    I don’t use Gutenberg or Classic Editor for much. Most stuff I do on Siteorigin Pagebuilder.

    Do I have to use a more tag in order for the excerpt word count to work? I swear this use to work no problem.

    Thanks again!

    #1562578
    Anthony

    Will I need to use this?
    https://docs.generatepress.com/article/activating-read-custom-excerpt/

    EDIT: This is something different maybe. Nvm

    #1562738
    Elvin
    Staff
    Customer Support

    Will I need to use this?
    https://docs.generatepress.com/article/activating-read-custom-excerpt/

    This can actually give you clues.

    I can’t seem to get the excerpt length to be what I set it to in the Customizer > Layout > Blog settings. Not sure if something else is holding it back somewhere? I’ve shared a screenshot of my current settings and a link to my blog.

    By default, WordPress skips all of the excerpt_length and excerpt_more filters when the custom excerpt is used. This means the excerpt length and “read more” button won’t work if you’re using the excerpt metabox a.k.a. custom/manual excerpt.

    To clarify: Are you using the excerpt metabox (custom/manual excerpt)?

    If this is the case, you can try this PHP snippet:

    add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
    function tu_excerpt_metabox_more( $excerpt ) {
        $output = $excerpt;
    
        if ( has_excerpt() ) {
            $output = sprintf( '%1$s <p class="read-more-button-container"><a class="button" href="%2$s">%3$s</a></p>',
                wp_trim_words( $excerpt, 2, '...' ),
                get_permalink(),
                __( 'Read more', 'generatepress' )
            );
        }
    	
        return $output;
    }

    Change “2” in wp_trim_words( $excerpt, 2, '...' ) to the preferred excerpt length.

    If your post is showing full post content rather than excerpt, check this.
    https://docs.generatepress.com/article/excerpt-issues/#full-post-content-displaying-while-using-excerpt

    A wise man once said:
    "Have you cleared your cache?"

    #1563557
    Anthony

    That PHP Snippet worked! Thanks!

    #1564739
    Elvin
    Staff
    Customer Support

    No problem. Glad it works for you.:)

    A wise man once said:
    "Have you cleared your cache?"

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