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 echothere.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -