diff --git a/themes/osi/functions.php b/themes/osi/functions.php index 4a84a35..0a0a75d 100755 --- a/themes/osi/functions.php +++ b/themes/osi/functions.php @@ -407,3 +407,15 @@ function osi_adjust_offset_pagination( int $found_posts, WP_Query $query ) { return $found_posts; } add_filter( 'found_posts', 'osi_adjust_offset_pagination', 1, 2 ); + +/** + * Trim the Discourse comment body to 50 words. + * + * @param string $comment_body + * @return void + */ +function osi_wpdc_comment_body( $comment_body ) { + $trimmed_comment_body = wp_trim_words( $comment_body, 50, '(...)' ); + return $trimmed_comment_body; +} +add_filter( 'wpdc_comment_body', 'osi_wpdc_comment_body', 10, 1 );