How to control manual excerpt length?

Take a look on my answer here: Best Collection of Code for your functions.php file

If I understood your question correctly, it does what you are looking for.

Place this in functions.php:

function excerpt($num) {
    $limit = $num+1;
    $excerpt = explode(' ', get_the_excerpt(), $limit);
    array_pop($excerpt);
    $excerpt = implode(" ",$excerpt)."... (<a href="" .get_permalink($post->ID) ." ">Read more</a>)";
    echo $excerpt;
}

Then, in your theme, use the code <?php excerpt('22'); ?> to limit the excerpt to 22 characters.

🙂

Leave a Comment