[Resolved] How to disable excerpts completely

Home Forums Support [Resolved] How to disable excerpts completely

Home Forums Support How to disable excerpts completely

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1113084
    oge

    Hi

    I have an aggregated news website with feeds being pulled in by WP RSS Aggregator.

    How do I disable excerpts completely in GP?

    How do I disable excerpts on certain category pages?

    Thanks

    #1113413
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You can set the excerpt length in Customize > Layout > Blog to 0 to remove excerpts completely. Then you can hide the containing element like this:

    .entry-summary {
        display: none;
    }

    To target specific categories, you can do this instead:

    add_filter( 'excerpt_length', function( $length ) {
        $categories = array(
            'one-category',
            'another-category',
            'one-more',
        );
    
        if ( is_category( $categories ) ) {
            $length = 0;
        }
    
        return $length;
    }, 200 );

    Hope this helps ๐Ÿ™‚

    #1135825
    Randy

    Hi tom, I try to follow this. But there is gap (I dont know how name it) likes more padding.

    https://prnt.sc/qpfldi

    #1136221
    Tom
    Lead Developer
    Lead Developer

    Did you use the CSS as well?

    For example:

    .category-one-category .entry-summary,
    .category-another-category .entry-summary,
    .category-one-more .entry-summary {
        display: none;
    }
    #1136555
    Randy

    Niche I never regret buying generatepress.

    It done by resizing all featured image at same size.

    #1137027
    Tom
    Lead Developer
    Lead Developer

    Glad you got it working ๐Ÿ™‚

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