Customize WordPress Excerpt Length

1 Comment

Customize Excerpt Length in WordPressExcerpts are short, text only previews of posts that WordPress can use in various places as teasers or introductions.  These can be automatically generated or custom tailored when creating a Post.  By default these are limited to 55 words, but there is no easy way to increase or decrease this in WordPress settings.  With a little modification of your functions.php, you can adjust this number to suit your needs.

Open the functions.php in your current theme’s function.php*. In the example below we have increased the Excerpt length to 100 words.

[code]
// 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’);
[/code]

If you change themes, you’ll have to add this modification to the new theme’s function.php file as well.

* Standard disclaimer here. Before editing any critical files in WordPress you should make a backup and be prepared to roll back any changes in case you run into problems or conflicts.

 

Need help implementing this tip in your WordPress site? Contact us for our professional services.  We can also provide support & expertise in convenient “blocks” to suit your short and long term needs.

 

 

I'm the front-man of It's WordPress. I come from a diverse array of backgrounds, enjoying the opportunity to expand my knowledge base and skill set by re-inventing myself. I enjoy environments that focus on emerging information, technology and concepts. I put on the technical hat in my early 20s and never really looked back. I'm love technology and the internet, as well as the outdoors and avidly hike, kayak and camp every chance I get.

About Us

We can take you from concept, through design, development and deployment in one seamless process. Whether you choose a self-managed web site or need a continuing support relationship; we've got you covered.

Request Consulation

Ready to transform your vision into a reality? Just looking to see what it takes to get the ball rolling. Tell us about your project and we can help. No spam. No obligation. Just answers.

More from our blog

See all posts