get_comments_number() returns 0
Question
I am customizing a theme that has the following code to display comments:
if ( have_comments() ) : ?>
<h2 class="comments-title">
<?php
printf( // WPCS: XSS OK.
esc_html( _nx( 'One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'kadabra' ) ),
number_format_i18n( get_comments_number() ),
'<span>' . get_the_title() . '</span>'
);
?>
</h2>
however it always shows the following:
0 thoughts on “Post title”
even though I have several comments and the if ( have_comments() ) :
part is passed. Any ideas?
PS: wp_debug is enabled and show no errors as well.
0
comment-form, comments, php, theme-development, themes
6 years
2017-07-03T11:27:59-05:00
2017-07-03T11:27:59-05:00 0 Answers
92 views
0
Leave an answer