Hi there,
I'm trying to code a function (in functions.php) that returns me the number of characters in the excerpt, I think this example will illustrates better the scenario.
In functions.php
function custom_excerpt($excerpt_num){
$default_excerpt = get_the_content();
$new_default_excerpt = explode(' ', $default_excerpt, $excerpt_num);
array_pop($new_default_excerpt);
$new_excerpt = implode(' ', $new_default_excerpt);
return $new_excerpt;
}
In the template (inside a loop):
<?php custom_excerpt(15) ?>
Here I wanted to show an excerpt with 15 characters, but it's not returning nothig.
Any solutions? thanks!