How to Display Excerpt in WordPress Front Page

In this post, I’ll share How to Display Excerpt in WordPress. There are numerous ways to display excerpt in WordPress, few pieces of code can do the trick. You can also use custom excerpt option of WordPress to Display Excerpt in WordPress Front Page.

Updated on

In this post, I’ll share How to Display Excerpt in WordPress. There are numerous ways to display excerpt in WordPress, few pieces of code can do the trick. You can also use custom excerpt option of WordPress to Display Excerpt in WordPress Front Page.

How to Display Excerpt in WordPress Front Page
How to Display Excerpt in WordPress Front Page

Displaying Excerpt in WordPress post is useful to showcase the summary of your post in 20 to 30 words on the home page of your site or blog. Most of the people use it to encourage readers to read full article.

Fastest WordPress Hosting Anywhere!

Before digging into the world of scripts and WordPress functions, let’s read what is ‘Excerpt’.

What is Excerpt

By definition, Excerpt is a short extract of an article, or a piece of music or a featured part of a film.

In this context Excerpt is a summary of your blog post or a piece of content of your article which you want to highlight. You can also call excerpt a shot description of your inscription.

Excerpt in WordPress Front Page
Excerpt in WordPress Front Page

How to Display Excerpt in WordPress

Excerpt comes by default in WordPress as its one of the core function ‘ the_excerpt() ’. When we call excerpt though the_excerpt(), WordPress generates auto excerpts (summary of your post) as raw text within <p></p> tag along with a ‘more’ tag, which looks like this tag ‘ […] ’.

By using get_the_excerpt() function in WordPress

Normally excerpts function the_excerpt() used with in the loop file of your theme. Excerpt can be called by adding the below given code just after your post title with in the loop.php file or wherever you want to call it.

<?php $excerpt = get_the_excerpt() ?>

I always recommend to use child theme for editing theme files, here you can read more about it.

By using get_the_excerpt() function with excerpt_length filter

The default word length of excerpt in WordPress is 55 words and the limit can be changed by using the excerpt_length filter.

You can also use get_the_excerpt() function in WordPress to display desired number of characters of excerpt in WordPress.

<?php
tn_excerpt_char_length(140);
//tn change the number as per your requirement
function tn_excerpt_char_length ($tncharlength) {
$excerpt = get_the_excerpt();
$tncharlength++;

if ( mb_strlen( $excerpt ) > $tncharlength ) {
$subex = mb_substr( $excerpt, 0, $tncharlength - 5 );
$exwords = explode( ' ', $subex );
$excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
if ( $excut < 0 ) {
echo mb_substr( $subex, 0, $excut );
} else {
echo $subex;
}
echo '[...]';
} else {
echo $excerpt;
}}?>

There are may other ways to limit excerpt length in WordPress, here is a complete guide on How to Limit Excerpt Length in WordPress.

Enable Custom Excerpt option in WordPress 

  1. Go to Dashboard > Posts > Add New
  2. Click on the ‘Screen Options’ button
  3. Enable excerpt box option and
  4. You are done.
How to Enable Custom Excerpt option in WordPress
How to Enable Custom Excerpt option in WordPress

Now scroll down to find custom excerpt column, where you can write your own content as post summary, which will display excerpt in WordPress front page.

Did you find this post useful, share your feedback in the comment section below or let us know if you have any query we’ll be happy to help you.

Read More:
How to Display Code Snippets in WordPress Post or Page
Optimize WordPress Database: WP-Optimize [How to]
How to Leverage Browser Caching in WordPress

Photo of author
Saurabh K
Saurabh K is a technology enthusiast and part-time blogger. He loves to explore the efficient use of technology and gadgets. He is an outlier and lensman. Add him in your social circle to know more.
Disclaimer: Affiliate links of some product(s) are being used on this page, if you follow the link and make a purchase, we may receive compensation from respective companies. This compensation comes at no additional cost to you.

3 thoughts on “How to Display Excerpt in WordPress Front Page”

  1. Avatar of Jack

    Hi, Good share. It helped me to redesign my front page.
    Thanks

    Reply
  2. Avatar of CMarie

    I have seen other YouTube videos on how to do it but your 3-step instruction was the simplest! I now have the excerpt box in my editor. Thank you! 🙂

    Reply
    • Avatar of Saurabh K

      Glad! You find it useful. Thank you for stopping by.

      Reply

Leave a Comment

Your email address and website details will not be published. Required fields are marked with *.