Site logo

Archived topic

Read more Button on Blog-Site sometimes visible, sometimes not

4 replies · Started by Stephan on December 19, 2022

Viewing posts 1–5 of 5

Hello together, I have the following phenomena:

I have around 50 Blog posts. On the Blog-site itself, I show 9 Excerpts per page. First site is fine, after this, the read more buttons not always being shown.

What can I do to get them on all excerpts shown?

Thanks in advance for your help,

Stephan

I solved the problem now, reading another article with same problem.

Now I only have the last problem, that some buttons show "lees meer" (wanted) and the buttons, which are now shown too after putting code in the function.php, have the title "weiterlesen" (translation from the original read more). How I can change all to "lees meer"?
'
The code I put into the function.php:

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;
}

Hi Stephan,

Try changing your PHP code to this:

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"><a class="button" href="%2$s">%3$s</a></p>',
            $excerpt,
            get_permalink(),
            "Lees meer"
        );
    }
	
    return $output;
}

Thank you so much Ying, this works fine now :-)

Glad to hear that :)

This archived topic is closed to new replies.