I knew there had to be a reason that “is_home” was in there…and there is. Two read more buttons everywhere on the home page, without it. LOL. Always something.
SO…the PHP code that works is:
add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
function tu_excerpt_metabox_more( $excerpt ) {
$output = $excerpt;
if ( has_excerpt() ) {
if(is_archive() || is_home()) {
$output = sprintf( '%1$s <p class="read-more-container"><a class="button" href="%2$s">%3$s</a></p>',
$excerpt,
get_permalink(),
__( 'Read more', 'generatepress' )
);
}
}
return $output;
}
And the CSS to make it all happen:
.gb-inside-container {
display: flex;
flex-direction: column;
height: 100%;
}
.gb-inside-container > *:last-child {
margin-top: auto;
}
.generate-columns .inside-article {
display: flex;
flex-direction: column;
height: 100%;
}
.generate-columns .inside-article .entry-summary {
display: flex;
flex-direction: column;
flex-grow: 1;
}
.read-more-container {
margin-top: auto;
}
An interesting lesson in how *sometimes* someone else’s code isn’t quite what is needed. Or something like that. 😉 Anyway – thanks for seeing this through. Now back to converting WP Show Posts sites…