wordpress queries not working in functions.php -
the following code, in functions.php file returning nothing, not hi:
... <?php wp_reset_postdata(); $qr = new wp_query(); while( $qr -> have_posts() ) { echo "hi"; $qr -> the_post(); echo comments_number('0', '1', '%'); } ?>
try this:
$qr = new wp_query(' '); while( $qr->have_posts() ) { echo "hi"; $qr->the_post(); comments_number('0', '1', '%'); } wp_reset_postdata();
first, have pass @ least wp_query
. also, comments_number
echoes result, don't need echo
there.
Comments
Post a Comment