Site logo

Archived topic

No Excerpt

3 replies · Started by John on July 17, 2021

Viewing posts 1–4 of 4

Hi there,

Try this Snippet:

add_filter( 'generate_show_excerpt', function( $show ) {
    if ( cat_is_ancestor_of(6, get_query_var( 'cat' )) || is_category(6) ) {
        return true;
    }
    return $show;
} );

In the code you will see the number 6 in two instances - both need to be replaced with the Parent Category ID ( ie. Discussions ). You can get the ID by editing the category, then click in the browser URL bar to see the full URL within it you will see ID=#. Update the code to that.

Then the Discussions category archive ( if accessed directly ) or any Child Category of it will display the excerpt.

Worked like a charm, David. You're a wizard !

Huge, huge, huge thanks.

John

Awesome - so glad to hear that!

This archived topic is closed to new replies.