Archived topic
Read more on custom excerpt shows different text
3 replies · Started by aidatün on April 15, 2020
Hi, I used this code: https://docs.generatepress.com/article/activating-read-custom-excerpt/
But it shows a different "read more" text than the one I've configured in the customizer. How can i fix that?
Also, the code is not the same than default read more label, as I added some CCSS that is not working in custom excerpt links.
And a tag does not have title attribute, how to place it?
Hi there,
you can simply add your Read more text to either of those codes. Simply replace the Read more text with whatever you need.
Also, how about the CSS and title atributte?
Hi there,
What CSS did you add?
Try this for the title attribute:
add_filter( 'wp_trim_excerpt', function( $excerpt ) {
$output = $excerpt;
if ( has_excerpt() ) {
$output = sprintf( '%1$s <p class="read-more-button-container"><a class="button" href="%2$s" title="%4$s">%3$s</a></p>',
$excerpt,
get_permalink(),
__( 'Read more', 'generatepress' ),
the_title_attribute( 'echo=0' )
);
}
return $output;
} );