The length of the excerpt in wordpress is 55 words by default.
I can modify this value with the following code:
So, the following call will return just 20 words:
But I can't figure out how could I add a parameter to obtain different lengths, so that I could call, for example:
Any ideas? Thanks!
I can modify this value with the following code:
Code:
function new_excerpt_length($length) {
return 20;
}
add_filter('excerpt_length', 'new_excerpt_length');
So, the following call will return just 20 words:
Code:
the_excerpt();
But I can't figure out how could I add a parameter to obtain different lengths, so that I could call, for example:
Code:
the_excerpt(20);
the_excerpt(34);
Any ideas? Thanks!