Site logo

Archived topic

Excerpt Limit & Read More button Not Working

5 replies · Started by Alirio on June 24, 2021

Viewing posts 1–6 of 6

I might've missed the solution on the support forum.

I am redoing my website starting with a fresh database. Installed the Marketer theme. Imported all my posts. But, the front page with all the blog posts isn't limiting the excerpt (set to 20) and adding the Read more button/link except for one blog post card out of around 16 posts.

Any help is appreciated.

Thank you.

Rio

Oh I see. Yes, I am. I just removed the custom excerpt and the Read more button appeared.

How can I insert a button with a custom excerpt?

Thank you, Ying.

Perfect. Thank you!!! I also added a class to it.

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 class="read-more" href="%2$s">%3$s</a>',
            $excerpt,
            get_permalink(),
            __( 'Read more →', 'generatepress' )
        );
    }

    return $output;
}

Nice!

You are welcome :)

This archived topic is closed to new replies.