June 16, 2014

Textual description of firstImageUrl

How To Customize Number Of Words For Short Excerpt Of WordPress

|
Here is a quick guide on how to customize or control the number of words to the short excerpt.


1. Copy the set of code below.

// Change number of words displayed in the excerpt

add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

function custom_excerpt_length( $length ) {
    return 30;
}


2. Go to function.php and paste it there.

3. Note: The number of words in the code above is set at 30 words. You can change it to your preference.

4. Click Update File button.

Caution: Make sure you paste the code correctly in the function.php

It should be BEFORE this tag ?>

For more details on where to paste code to a php file.