Reputation: 227
The following code, in the functions.php file is returning nothing, not even hi:
...
<?php
wp_reset_postdata();
$qr = new WP_Query();
while( $qr -> have_posts() ) {
echo "hi"; $qr -> the_post();
echo comments_number('0', '1', '%');
} ?>
Upvotes: 0
Views: 803
Reputation: 1013
Try this:
$qr = new WP_Query(' ');
while( $qr->have_posts() ) {
echo "hi"; $qr->the_post();
comments_number('0', '1', '%');
}
wp_reset_postdata();
First, you have to pass at least something to WP_Query
. Also, comments_number
already echoes the result, so you don't need that echo
there.
Upvotes: 1