Hello,
I’ve been trying to reach that with no success.
Could it be possible to have two different excerpt lengths?
I’ve been trying this code but something goes wrong…
In my functions.php:
function custom_excerpt($new_length = 20, $new_more = '...') {
add_filter('excerpt_length', function () use ($new_length) {
return $new_length;
}, 999);
add_filter('excerpt_more', function () use ($new_more) {
return $new_more;
});
$output = get_the_excerpt();
$output = apply_filters('wptexturize', $output);
$output = apply_filters('convert_chars', $output);
$output = '<p>' . $output . '</p>';
echo $output;
}
In my template:
<?php custom_excerpt(40, 'moo') ?>