How can I display post excerpt in the Blog archive?

We’re trying to keep it simple wherever it’s possible. That’s why the blog archive and each card have three simple elements: the featured image, the title, and the meta details. However, if the post excerpt is an important part of your posts, you can easily display it right after the meta by doing this simple change. All you have to do is use this piece of code:


function custom_function_add_blog_excerpt() {
	echo '<div class="post__excerpt">' . the_excerpt() . '</div>';
}
add_action ('blog_archive_post_excerpt', 'custom_function_add_blog_excerpt');

There are two options for adding it to your website:

  1. You can copy it to the functions.php of the child theme. You can find some more details about this right here;
  2. Install the Code Snippets and add the code through it.
Updated on March 23, 2023

Can't find what you’re looking for? Ask a human.

We're a small team of real people providing real help. Send us an email at [email protected] and we will give you a helping hand.