I just stumbled across these two little pieces of code and thought that they might be useful to some people out there who want to mess around with the default settings for the_excerpt()
function in WordPress. The first one gives you the power to change the number of words displayed by the function the_excerpt()
, and yes, you can have more than 55 words. The second piece of code allows you to change the trailing […] that appears at the end of your excerpt.
Both features are set to be added to version 2.9 of WordPress, but the first currently works in version 2.8.5. Just add these to your theme’s functions.php file.
function new_excerpt_length($length) { return 20; } add_filter('excerpt_length', 'new_excerpt_length');
Change the number “20” to whatever number you want.
function new_excerpt_more($more) { return '[.....]'; } add_filter('excerpt_more', 'new_excerpt_more');
Change “[…..]” to whatever you want.