Site logo

Archived topic

Remove excerpt (entry-summary) on CPT archive page

10 replies · Started by Fabien on March 3, 2022

Viewing posts 1–11 of 11

Hi,

Is there a function to fully remove entry-summary on an archive page ? I've tried add_filter( 'generate_show_excerpt', '__return_false' );, it removes entry-summary but displays entry-content instead (the full post).

Thanks

Is that the only way ?

Using a block element – content template is the easiest way.

Or you need to install a child theme, take a copy of the content.php and archive.php to your child theme folder, rename them, eg. content-yourcpts.phpand archive-yourcpt.php.
https://docs.generatepress.com/article/using-child-theme/

Remove this part from content-yourcpts.php

<div class="entry-summary"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
				<?php the_excerpt(); ?>
			</div> 

In archive-yourcpt.php file, Replace this line generate_do_template_part( 'archive' ); with get_template_part( 'content', 'yourcpts' );

There isn't a function to easily do that like you can do with the featured image ?

add_filter( 'option_generate_blog_settings', function( $options ) {
if ( is_tax( 'modele_cat' ) ) {
$options['post_image'] = false;
}

return $options;
});

If I am correct, that doesn't remove the entry-summary div :-(

Correct.
If you must remove the <div> then the methods Ying provided are the only way to do that today.

Ok noted ! Would be great to be able to remove the <div> using a function. Maybe something to add to the next roadmap ?

Its on our list :)

Awesome, thanks @David !

This archived topic is closed to new replies.