Hi
I would like same excerpt length on the blog post grid and I have used the following coding however it hides the read more button too :( which I would still like to show, please
// Excerpt length
function custom_excerpt(){
?>
<script>
// trim sentence by 22 words
	function trimByWord(sentence,wordcount = 22) {
		var result = sentence;
		var resultArray = result.split(” “);
		if(resultArray.length > wordcount){
		resultArray = resultArray.slice(0, wordcount);
		result = resultArray.join(” “) + “…”;
		}
		return result;
	}
jQuery(window).load(function(){
    jQuery(‘.post-entry’).each(function() {
     	jQuery(“.entry-content “).text(function(index, currentText) {
     		return trimByWord(currentText);
		 });
    	jQuery(“.entry-title a”).text(function(index, currentText) {
   		return trimByWord(currentText,15); // trim title by 15 words
		 });
    });
});
</script>
<?php
}
add_action(‘wp_head’, ‘custom_excerpt’);
Hey info224,
Please share the link to your website too.
Best regards,
Victoria
Hi
Please find the details below. I have removed the coding at present.
Hi
I was wondering if someone could come back to me :)
Thanks.
Hi,
Sorry for the delay. Please remove the previous script and use this filter instead.
add_filter('avf_postgrid_excerpt_length','avf_postgrid_excerpt_length_mod', 10, 1);
function avf_postgrid_excerpt_length_mod($length)
{
   $length = 30;
   return $length;
}
Default excerpt length value is 60.
Best regards,
Ismael
