Show the excerpt on the homepage of WordPress blog

Show the excerpt on the homepage of WordPress blog: This is post is going to be strictly for the first time users who want to show the excerpt on the homepage of WordPress blog rather than showing whole content.

Most of the themes have the option of showing only except of the content on homepage but you must have stumbled upon the ones who do not. Well showing only the excerpt of content on the homepage is also beneficial because its reduces the page load time which ultimately makes visitor happy.

Show the excerpt on the homepage of WordPress blog

Therefore, it’s a win-win situation for everyone and without wasting any time let’s see how show excerpts.

Show the excerpt on the homepage of WordPress blog

There two methods to show the excerpt on the home page of WordPress lets just discuss them one by one.

Method 1: Using WordPress Plugin

I believe WordPress plugins have made our life simpler and everything can be done with the help of WordPress plugins. Hopefully, this is the case here as we are going to learn how to show the excerpt on the homepage of WordPress blog using a plugin. Here is what you do:

Advanced Excerpt

1.Go to your WordPress admin and navigate to Plugins>Add New.

2.In the Plugin search, type “Advanced Excerpt” and this will automatically bring up the plugin.

3.Just install the plugin and activate it.

4.Here is the direct link to the plugin WordPress page.

5.After successfully installing the plugin, go the Advanced Excerpt settings(Settings>Excerpt).

6.Here you can change the excerpt length to your needs and many other settings, well don’t bother as you just need to change excerpt length, tick “Add read more link to excerpt” and you can customize “Disable On.”

advanced excerpt options

7.Finally, hit the save button and you are good to go.

Method 2: Manually adding the excerpt code

Most of the users will definitely use the above method but if for some reason you don’t want to install another plugin to do your job then you are welcome to manually do it yourself.

Just open your index.php, category.php and archive.php file as you want to show excerpts on these pages. Find the following line of code:

<?php the_content(); ?>

Replace it with this:

<?php the_excerpt(); ?>

And rest will be taken care by WordPress automatically. But here comes the problem how do you change the word limits? Well for that you have to change another line of code.

From Appearance go to Editor then open function.php file and add the following line of code:

// Changing excerpt length
function new_excerpt_length($length) {
return 80;
}
add_filter('excerpt_length', 'new_excerpt_length'); 
// Changing excerpt more
function new_excerpt_more($more) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');

Just change the value after return to adjust it according to your needs.

In some cases, WordPress does not automatically provide the link to the full post beneath the excerpt and in that case, you need to again add the following line of code to your function.php file:

function new_excerpt_more( $more ) {
	return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">' . __('Read More', 'your-text-domain') . '</a>';
}
add_filter( 'excerpt_more', 'new_excerpt_more' );

That’s it now you can easily show the excerpt on the homepage of WordPress blog. And you can choose which method to use but as you can see the second method is not exactly easy so prefer the first one.

If you still have a question regarding this guide then feel free to ask them in the comment section and I will take care of the rest.

Do you have any other ways to add the excerpt to the WordPress blog? I would love to hear about them.

Leave a Comment

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