Site logo

Archived topic

Read More buttons not showing

7 replies · Started by Former User on April 8, 2020

Viewing posts 1–8 of 8

I posted this same issue a couple of days ago but now cannot find the thread, either in the main forum or in the tickets opened by me under my profile. Weird.

Anyway, to repeat:

I'm using a custom excerpt on blog posts. The read more buttons on the homepage/category pages disappears when this field in Gutenberg editor is filled with a custom excerpt. Please advise how to get the buttons back?

I'm using the latest versions of WordPress and GeneratePress.

Settings -> Reading -> Summary is enabled.

I've already tried using the CSS provided in other threads/help articles, e.g.

add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
function tu_excerpt_metabox_more( $excerpt ) {
$output = $excerpt;

if ( has_excerpt() ) {
$output = sprintf( '%1$s <p class="read-more-button-container">%3$s</p>',
$excerpt,
get_permalink(),
__( 'Read more', 'generatepress' )
);
}

return $output;
}

But receive a warning that this CSS is not valid and I need to correct it before publishing in case it breaks the website.

Thanks, looking forward to hearing back from you.

Hi David,

Thanks for your reply.

My bad, I just copy/pasted and didn't even register that it wasn't CSS.

Okay, I've installed Code Snippets as per the documentation and tried to add this PHP code, but the code editor is still warning me that it isn't valid.

Could you please let me know the code I should use for this snippet? Desired outcome: The Read More button shows on category pages if the custom excerpt field is filled.

Thanks again.

Thanks very much. :)

You're welcome

I just wanted to tell you guys that your support is exellent! This helped a lot!

Awesome - glad we can be of help :)

This archived topic is closed to new replies.