[wp-testers] Something odd happening with WP_Query()

Michael E. Hancock justmichaelh at gmail.com
Sat Nov 29 15:52:59 GMT 2008


----- Original Message ----- 
From: "Paul Robinson" <pablorobinson at gmail.com>
> Sooooo I was wonding if anyone could shed some light on why the_tags() 
> isn't
> working inside a WP_Query(); loop. I'm not sure if it's a new thing which 
> is
> why I'm posting it in this list.

Ronald Huereca (and Aaron's comments) in 
http://weblogtoolscollection.com/archives/2008/04/19/paging-and-custom-wordpress-loops/ 
explain why this works:

<ul>
<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('category_name=Featured&showposts=1'.'&paged='.$paged);
?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
 <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); 
?></a></li>
  <li><a href="<?php the_tags() ?></li>
<?php endwhile; ?>
</ul>
<?php $wp_query = null; $wp_query = $temp;?>


MichaelH




More information about the wp-testers mailing list