Change the excerpt length: There are many cases where a blog author might want to increase or decrease the length of WordPress post excerpts "the_excerpt()". Excerpts are basically condensed descriptions of your blog posts and are commonly used to provide introductory "teaser" information about the post. In the following simple solution, I'll show you how to lengthen or shorten the excerpt in WordPress to suite your personal blogging needs.
How to Change the WordPress post excerpt length:
- Login to your WordPress Site and perform the following steps:
- Navigate to Appearance section in the Sidebar and Click Editor
- Click the Theme Functions or "functions.php" template file
- Just above the closing <?php } ?> tag add the following code:
add_filter('excerpt_length', 'my_excerpt_length');
function my_excerpt_length($length) {
return 20; }
- Change 20 to the length you would like the WordPress excerpt to be
- Update the file and and go view your site
(Click the Screenshot for a visual of these steps)
That's all there is to it. Now when you visit a section on your site containing a post excerpt, the length of the excerpt will reflect the number of characters you have set to display as an excerpt.
Enjoy! ;)