• Hey,

    When I write a custom excerpt in Gutenberg for the post, the Read More button not showing on the Post archive page.

    How to fix this?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Elvin

    (@ejcabquina)

    Hi there,

    You can refer to the brief documentation found here on how to add in the Read more button when using custom excerpt:
    https://docs.generatepress.com/article/activating-read-custom-excerpt/

    Here’s how to add PHP snippets – https://docs.generatepress.com/article/adding-php/

    Thread Starter gojiyarockey7

    (@gojiyarockey7)

    Yeah, I have added the code
    https://asterikfitness.com/
    On this website.

    Check on 4th page. I have maked button full size, but when custom excerpt is on it shows different buttons. I want to show same button as other posts

    Elvin

    (@ejcabquina)

    Try this instead:

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

    The button was missing a “read-more” class. I’ve added it in the code so the exact same classes are the same for both auto excerpt read more and the manually added read more button.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘GeneratePress Read More Button’ is closed to new replies.