How to Add Excerpt in WordPress (Homepage, Archives, Custom Post Types)

Excerpt simple means a short extracted piece of writing to give your users an idea about post. We add excerpt of our blog posts on homepage, archives pages and custom post types to let our users know an idea about the post content. Let’s say, if they find excerpt of posts interesting then they will simply click the read more for complete article.

If you are WordPress user then I guarantee you that you must have troubleshooted excerpt issue in your blog. Because many themes don’t have excerpt feature on homepage, archives or custom post types pages. I’m writing this article, to help WordPress users on how to add excerpt in WordPress.

How to Add Excerpt in WordPress

In order to add excerpt in WordPress, I’m going to list down 3 best WordPress plugins that can be very helpful for adding excerpt in WordPress.

That’s how your posts will look like on homepage, archive pages and custom post types:

How to add excerpt in WordPress

Advanced Excerpt

With Advanced excerpt WordPress plugin you will be able to control the appearance of WordPress post excerpts on homepage, archive pages and also on custom post types. This plugin has really made the default WordPress coding standards simpler by keeping the HTML markup in the excerpt and you can choose which tags are included to display excerpt on. Advanced excerpt plugin is really an advanced in trimming the full content to display as excerpt and also you can trim to a specified amount of length using either character count or word count.

Related  How to: Sell Direct Ads on Your WordPress Blog with CrankyAds?

Advanced excerpt helps you to customize the excerpt length and the ellipsis character that are used. It completes the last word in the content so people don’t leave with incomplete word or sentence in an excerpt. You can add read more link to the text and if you ever wish to ignore the custom excerpt that can be done with Advanced excerpt plugin. If you are a theme developer you can use the_advanced_excerpt() within your theme to add excerpt feature in your themes.

Download Advanced Excerpt

Read More Excerpt Link

If you use read more excerpt link WordPress plugin you will be able to replace the default WordPress ellipsis […] to a Read More link to the full post content in your blog. However, you can rename the read more link text to anything you want, by going under Settings → Read More Excerpt.

Download Read More Excerpt Link

Auto Excerpt everywhere

Auto excerpt everywhere plugin adds excerpts everywhere on your blog including homepage, archive pages and even on custom post types. Don’t worry, you can add your own custom excerpts too because they are supported. However, this plugin haven’t been updated in a while so I would prefer to use the 2 plugins above rather than this one. But use it at your own risk.

Download Auto Excerpt Everywhere

How to Add Excerpt In WordPress without a plugin

To display excerpts in your site without plugin, you have to go to your theme files and locate the file where you want the excerpts to appear, such as index.php, archive.php, or single.php.

Related  How to Add Twitter Trends Widget in WordPress

Add the following code within the WordPress loop:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <div class="post-excerpt">
        <?php the_excerpt(); ?>
    </div>
<?php endwhile; endif; ?>

Now, to customize excerpt length, add the following code to your functions.php file or add snippet if you have snippets plugin installed:

function custom_excerpt_length($length) {
return 20; // Set the desired excerpt length (number of words)
}
add_filter('excerpt_length', 'custom_excerpt_length');

Adding Read more link in excerpt:

To customize the “Read More” link, add this code to your functions.php file:

function custom_excerpt_more($more) {
    return '... <a href="' . get_permalink() . '">Read More</a>';
}
add_filter('excerpt_more', 'custom_excerpt_more');

These steps will enable you to add and display excerpts in your WordPress theme. If you are not able to do it on your own, you can leave a comment below I will get back as soon as possible.

2 Comments

  1. Thanks for info on the plugins Auto Excerpt Everywhere and the Read More Excerpt Link. I have a theme that displays excerpts on the home page, but not on the tags and category page. Hope they can help with this problem.

Leave a Reply

Your email address will not be published. Required fields are marked *