Skip to content

Instantly share code, notes, and snippets.

@itthinx
Last active November 2, 2021 09:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save itthinx/7f759490e1acd565a3532ee4d3cd9534 to your computer and use it in GitHub Desktop.
An example of using the decent_comments_comment_output filter to customize output
<?php
//
// An example filter implementation provided in response to this question on the Decent Comments plugin for WordPress
//
// https://wordpress.org/plugins/decent-comments/
//
// https://www.itthinx.com/plugins/decent-comments/comment-page-3/#comment-1127674
//
function my_decent_comments_comment_output( $output, $comment_ID, $options ) {
$comment = get_comment( $comment_ID );
if ( $comment instanceof WP_Comment ) {
$n = get_comments_number( $comment->comment_post_ID );
$output .= '<div class="comments-count">';
$output .= sprintf( _n(
'There is one comment on this post.',
'There are %d comments on this post.',
$n
) );
$output .= '</div>';
}
return $output;
}
add_filter( 'decent_comments_comment_output', 'my_decent_comments_comment_output', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment