Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions themes/osi/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );