diff --git a/themes/osi/functions.php b/themes/osi/functions.php index 4a84a35..7aa6fea 100755 --- a/themes/osi/functions.php +++ b/themes/osi/functions.php @@ -407,3 +407,16 @@ 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 The comment body. + * + * @return string The trimmed comment body. + */ +function osi_wpdc_comment_body( string $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 );