This topic has 6 replies, 3 voices, and was last updated 8 years, 7 months ago ago by Jack Richardson
Hi,
At the moment my blog excerpts are showing as the default 55 words, set by lines 690-713 in the theme-functions.php file. I’d like to set the excerpt length by number of characters (preferably to include spaces), rather than words – this is to ensure excerpt boxes are all of the same height. Please advise how to achieve this. Thank you in advance.
Best wishes … Tim
Hello,
Excerpts are shown the ones which you selected in posts editor adding “read more” tag http://storage4.static.itmages.com/i/16/0405/h_1459861316_6826319_b3d3191325.png .
As you can see excerpts height is different because your images have different height.
Try to use this code in Custom CSS for desktop section:
article.post-grid .wp-picture img {
height: 250px;
}
and change excerpt height moving “more” tag.
Regards,
Eva Kemp.
Hi, thanks for your quick reply once again,
I’m happy with the different heights on the blog archive page, it’s on the homepage where I’d like the boxes to be of equal height. The only way I can see to do this is to limit the excerpt by number of characters. Is this doable please?
Thanks … .Tim
Hello,
You can use this css code to align blocks in one line:
.page-id-31 .vc_gitem_row {
height: 360px;
}
Regards,
Eva Kemp.
Sorry, but that’s still not what I need – I need to limit the length of the excerpt by the number of characters, not by the number of words … if possible?
Any help would be very much appreciated. Thank you in advance, best wishes, Tim
This is what is limiting it by words (55) at the moment, from theme-functions.php:
if(!function_exists(‘et_excerpt’)) {
function et_excerpt($text, $excerpt){
if ($excerpt) return $excerpt;
$text = strip_shortcodes( $text );
$text = apply_filters(‘the_content’, $text);
$text = str_replace(‘]]>’, ‘]]>’, $text);
$text = strip_tags($text);
$excerpt_length = apply_filters(‘excerpt_length’, 55);
$excerpt_more = apply_filters(‘excerpt_more’, ‘ ‘ . ‘[…]’);
$words = preg_split(“/[\n
]+/”, $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
if ( count($words) > $excerpt_length ) {
array_pop($words);
$text = implode(‘ ‘, $words);
$text = $text . $excerpt_more;
} else {
$text = implode(‘ ‘, $words);
}
return apply_filters(‘wp_trim_excerpt’, $text, $excerpt);
}
}
Hello,
Please take our apologies but there is no feature to limit length of the excerpt by the number of characters.
Best regards,
Jack Richardson.
Tagged: best selling, blog excerpt length, persuasive, set characters, themes, woocommerce, words
You must be logged in to reply to this topic.Log in/Sign up