Hi @poomik,
I understand you’re looking to display post excerpts instead of the full content on your blog page using the Storefront theme, and it definitely makes sense for improving readability and keeping the page more compact, like in your previous setup.
By default, Storefront displays full post content on blog/archive pages, but you can switch it to show excerpts by adding a small code snippet to your child theme’s functions.php file or via a custom plugin. Here’s how:
add_filter( 'the_content', 'use_excerpt_on_blog_pages_with_read_more' );
function use_excerpt_on_blog_pages_with_read_more( $content ) {
if ( is_home() || is_archive() ) {
global $post;
$excerpt = get_the_excerpt();
$read_more = '<p><a class="read-more-button" href="' . get_permalink( $post->ID ) . '">Read More</a></p>';
return $excerpt . $read_more;
}
return $content;
}
// Set excerpt length
add_filter( 'excerpt_length', function( $length ) {
return 30; // number of words
}, 999 );
// Set excerpt "more" text
add_filter( 'excerpt_more', function() {
return '...';
});
And if you want the “Read More” link to look like a button, you can add this under Appearance → Customize → Additional CSS:
.read-more-button {
display: inline-block;
background-color: #0073aa;
color: #fff;
padding: 8px 16px;
text-decoration: none;
border-radius: 3px;
font-weight: bold;
}
.read-more-button:hover {
background-color: #005d8f;
}
Please let us know if that works or if you need any more help with this.
Thanks LovingBro
It have been solved with a free plugin called “Storefront Blog Excerpt”
Hi @poomik,
Thanks so much for the update. I’m happy to hear that the Storefront Blog Excerpt plugin worked for you and that your blog page now shows excerpts just the way you wanted!
If the Storefront theme has been helpful for your site and you’ve enjoyed working with it, we’d really appreciate it if you could leave a quick 5-star review here: https://wordpress.org/support/theme/storefront/reviews/#new-post
Actually the thanks is going to https://www.businessbloomer.com/
Hi @poomik,
Thanks for your response. I’m not quite sure I understand your last message. Could you please clarify what you meant by “The thanks is going to https://www.businessbloomer.com/”?
Ah, I see now — thanks for clearing that up, @poomik!