Immaking my first theme and Im trying to show comments on the post, but for some reason its not working.
This is single.php:
comments_template(); //SOmeone said its necessary...
echo get_comments_number(); //This returns 2
if (have_comments()): //This returns "Has not"
echo "Has";
else:
echo "Has not";
endif;
What am I missing?
You have to call comments_template()
first, otherwise have_comments()
does not work.
Don't ask me why, it's an idiosyncrasy of WordPress.