My particular WordPress theme looked great but I found it a bit frustrating when I could only see a dozen or so words before “Read More”. It was not enough to generate interest in the article so I had to find out how to increase it. It’s actually fairly simple when you know how!
To be honest I expected this to be a configuration option within WordPress. After all, it is just a change in the number of words that appear. I would have thought it would have been a simple process to add an option where you type in the maximum number of words required. Turns out I was wrong.
You have to make a change to the source code for your template. However, it is a fairly simple thing to do.
To change this log into your dashboard and then go to Appearance and Editor. Select Theme functions from the list so you can see the source code. Scroll through the code until you see an entry which says something like
function new_excerpt_length($length) {
return 55;
}
add_filter(‘excerpt_length’, ‘new_excerpt_length’);
All you need to do is change 55 to the number of words you would like to see.
It is also possible that your WordPress theme has the default limit so you won’t find an entry in this file. If this is the case add the following to the file
add_filter(‘excerpt_length’, ‘my_excerpt_length’);
function my_excerpt_length($length) {
return 55; }
Again, you can change the figure 55 to the number of words you want to appear in your WordPress blog summary.
I would have thought this is a fairly easy thing for a theme designer to add. Or a small modification for WordPress to add. It would then allow you to change the number of words without having to mess around with the code. After all, if you upgrade to a new version of your theme these changes will be overwritten so having it as a configuration setting would make it simpler all round.
Did you find this post helpful?
If you found this post helpful please take a moment to tweet, like, or share this article by using the buttons at the top or bottom of this page. I’d really appreciate it. 🙂 Also, if you are feeling extra generous please leave some encouraging feedback in the comments section at the bottom of the page. I love getting feedback from visitors. It encourages me to continue writing useful articles for readers like you. Thanks for taking the time to read my website! You can find other articles that you might find useful at the bottom of this post. Enjoy!
Sandy says
thanks, nice article, it helped me a lot
Veronica says
I want to shorten my posts on the main page of my WordPress blog. I tried telling it to show summaries but it didn’t work so I want to try this option. Where do I put the code for excerpt length whiten my code?
Kevin Craighead says
To change this log into your dashboard and then go to Appearance and Editor. Select Theme functions from the list so you can see the source code.