Reputation: 259
Forgive this noobie question, but I have searched extensively through prior answers. Is it possible to limit the length of an excerpt within the_excerpt()
? That is, can you limit the length of output without using external PHP?
Upvotes: 0
Views: 1868
Reputation: 1260
As mentioned in the WordPress codex, the excerpt_length
filter should be used to limit the excerpt length.
Insert the following code in your active theme's functions.php
file.
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
While this method involves handling PHP code, there are also plugins in the WP directory that implement this out of the box.
Upvotes: 2