Site logo

Archived topic

How do I only have post titles appear in categories

3 replies · Started by RJ on April 20, 2018

Viewing posts 1–4 of 4

Is there a way to only show the post titles in a category. Like this.

I want the image and excerpt removed.

Thanks in advance...

Hi there,

This snippet should remove featured image on category pages:

add_filter( 'option_generate_blog_settings', 'lh_remove_category_featured_image' );
function lh_remove_category_featured_image( $options ) {
    if ( is_category() ) {
        $options['post_image'] = false;
    }
    return $options;
}

This should remove the excerpt on category pages:

add_filter( 'excerpt_length','lh_custom_excerpt_length', 1000 );
function lh_custom_excerpt_length( $length ) 
{
    if ( is_category() ) {
        return 0;
    } else {
        return $length;
    }
}

Adding PHP: https://docs.generatepress.com/article/adding-php/

Thanks Leo. Much appreciated.

No problem :)

This archived topic is closed to new replies.