If you are blogger whose posts are normally long, your blog won’t looking appealing in design to your users when they visit your blog and find out the content of all post been displayed on your homepage. Adding a Read More link with an Excerpt of the first few letters of the blog post adds professionalism to your blog.
There are quite some advantages to this such as decreasing your blogs Load Time, and it increases your Page Views and people would need to open article before they can read the full blog post.
Here is how you can add excerpts to your wordpress theme.
Adding Excerpts to your WordPress Theme
- Login to your WordPress Dashboard, click on Appearance > Editor.
- Click on Functons.php on the right sidebar.
Copy and paste this code below in the last line of your functions.php// Changing excerpt length
function new_excerpt_length($length) {
return 100;
}
add_filter(‘excerpt_length’, ‘new_excerpt_length’);// Changing excerpt more
function new_excerpt_more($more) {
return ‘…’;
}
add_filter(‘excerpt_more’, ‘new_excerpt_more’);Now click on Update File
- Now click on index.php , search for
<?php the_content(); ?>
And replace with
<?php the_excerpt(); ?>
Click on Update file.
- Perform the same process you made on index.php to archive.php file, search.php and category.php (if they exist)/li>
Reload your blog and see the magic. Why not subscribe to our newsletters today.
3 Comments
thanx Oscar Frank i was searching for this
Hi Ajay,
I’m so glad you found your solution here.
Thanks. I once looked for this