Hi!
How can I remove the custom excerpt from the blog archive page, but leave the read more text?
I add this into my functions.php:
function remove_image_size_attributes( $html ) {
return preg_replace( '/(width|height)="\d*"/', '', $html );
}
add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
function tu_excerpt_metabox_more( $excerpt ) {
$output = $excerpt;
if ( has_excerpt() ) {
$output = sprintf( '%1$s <a href="%2$s">%3$s</a>',
$excerpt,
get_permalink(),
__( 'Read more', 'generatepress' )
);
}
return $output;
}
And that allows the read more button to show with the custom excerpt. However, I don’t want the custom excerpt to show on the main blog archive page.
Things I’ve tried so far:
- Setting Excerpt word count to 0 in Customizer (it still shows the excerpt)
- Hiding the excerpt using CSS (this hides the read more button as well)