How can I display post excerpt in the Blog archive?

We’re trying to keep simple wherever it’s possible. That’s why the blog archive and each card has 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. Simply install the My Custom Functions plugin and add the code through it.
Updated on September 27, 2018

Was this article helpful?