Skip to content

Commit

Permalink
More reliable method for getting comment counts on directories.
Browse files Browse the repository at this point in the history
  • Loading branch information
boonebgorges committed Mar 24, 2016
1 parent 446a9f1 commit 4ea0ab7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion includes/hooks-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,8 @@ function cacsp_directory_action_metadata() {
}

// Comment count.
$comment_count = (int) get_post()->comment_count;
$comment_counts = wp_count_comments( get_the_ID() );
$comment_count = isset( $comment_counts->approved ) ? (int) $comment_counts->approved : 0;
if ( 1 === $comment_count ) {
$chunks['comment_count'] = __( '1 comment', 'social-paper' );
} elseif ( 1 < $comment_count ) {
Expand Down

0 comments on commit 4ea0ab7

Please sign in to comment.