Twenty Twelve Theme for WordPress, Number of Word in Excerpt

You need only to add these lines to your twenty twelve theme functions.php. I advise you to create a child theme for wordpress before adding. WordPress themes are usually updated frequently. If you do not create a child theme, at the next reboot, the changes you entered may be lost.

You can enter this code at the end of the function, remember that in this example, the number 20 represents the maximum number of words that can be included in the excerpts.

function twentytwelve_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'twentytwelve_excerpt_length' );

To have an optimal result, you can do several tests. Usually 20 words for an excerpt are few. If you have any problems or my guide has not been very clear, leave a comment and we’ll see you solve it together.

 

Rispondi