Viewing 1 replies (of 1 total)
  • Plugin Author livemesh

    (@livemesh)

    Pls have the following code in your (child) theme functions.php –

    add_filter('lae_posts_grid_entry_excerpt', 'mytheme_restrict_excerpt', 10, 1);
    
    function mytheme_restrict_excerpt($excerpt) {
    
        $excerpt = '<div class="entry-summary">';
    
        $length = 120; // number of characters without breaking the words
    
        $append = '...';
    
        $string = get_the_excerpt();
    
        $string = trim($string);
    
        if(strlen($string) > $length) {
            $string = wordwrap($string, $length);
            $string = explode("\n", $string, 2);
            $string = $string[0] . $append;
        }
    
        $excerpt .= $string;
    
        $excerpt .= '</div>';
    
        return $excerpt;
    }
Viewing 1 replies (of 1 total)

The topic ‘Reduce Excerpts’ is closed to new replies.