Hi! Try adding this snippet of code to your theme’s functions.php file:
function short_excerpt($num) {
$limit = $num+1;
$excerpt = str_split(get_the_excerpt());
$length = count($excerpt);
if ($length>=$num) {
$excerpt = array_slice( $excerpt, 0, $num);
$excerpt = implode("",$excerpt)."…";
echo $excerpt;
} else {
the_excerpt();
}
}
The snippet above includes a new function called short_excerpt()
. Instead of using <?php the_excerpt() ?>
at lines 46-48 of the Spacious content.php file, you can now use the new short_excerpt()
function and your desired character limit. For example, if you want to limit your excerpt to 25 characters the code would look like this:
<?php short_excerpt(25); ?>