Hi Bart. Here’s an answer to a post that provides a function you could use in a child theme functions.php file. To use it you’d also need to change:
<?php the_excerpt(); ?>
to
<?php get_excerpt(); ?>
in the following theme files depending on where you want to use it:
content.php
content-featured.php
content-standard.php
Thank you. It worked pretty well!
For everyone’s convenience, I have added the following to my child function.php:
function get_excerpt($limit, $source = null){
if($source == "content" ? ($excerpt = get_the_content()) : ($excerpt = get_the_excerpt()));
$excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, $limit);
$excerpt = substr($excerpt, 0, strripos($excerpt, " "));
$excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));
$excerpt = $excerpt.'... <a href="'.get_permalink($post->ID).'"><i class="fa fa-sort-down"></i></a>';
return $excerpt;
}
And in my content-featured.php I have adjusted the following:
<?php the_excerpt(); ?>
And changed it to:
<?php echo get_excerpt(40); ?>
Thanks again!