Site logo

Archived topic

Continue Reading button not showing on Archives

9 replies · Started by Glen on December 6, 2022

Viewing posts 1–10 of 10

Example Archives Page: https://www.glenhuff.com/category/social-media-best-practices/page/4/

For some reason, none of the blog posts on an archive page have a "Continue Reading" link after the excerpt. I have the label set in the settings under:
Theme > Customize > Blog > Archives > Read more label = "Continue Reading". Yet, nothing appears. The title links to the single blog posts, but I wanted a read more button after the excerpt. How do I do this?

Thank you. I found a link on that page useful. It sent me to this: https://docs.generatepress.com/article/activating-read-custom-excerpt/

I added the following code to the theme-functons.php file and it worked.

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(),
            __( 'Read more', 'generatepress' )
        );
    }
	
    return $output;
}

Is this something I'll have to add every time the theme updates?

Using a child theme seems like the easiest route. I don't have one installed. Is there a download for the GP child theme?

Okay, I have the child theme installed. My function to show continue reading buttons with excerpts has been added. The archives look great.

But, now I'm seeing a continue reading button on the single post. The theme I'm using displays the excerpt as the first paragraph in a Hero Full-Width fashion.

Example: https://www.glenhuff.com/how-to-create-a-winning-social-media-strategy/

Can you edit the function to this instead?

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

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

Works perfectly! Thank you.

Glad to help :)

This archived topic is closed to new replies.