can I run new WP_Query inside the Loop with no affects to the Loop? (wordpress)
        Posted  
        
            by Radek
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Radek
        
        
        
        Published on 2010-05-16T05:28:23Z
        Indexed on 
            2010/05/16
            5:30 UTC
        
        
        Read the original article
        Hit count: 383
        
Wordpress
the bellow function is working fine but I need to run it inside the loop. If done so the post content is actually taken from the last post of my WP_Query. Not from the one that should appear.
Is there any way to run my query and leave The Loop unaffected?
function recent_post_by_author() {
  echo '<div class="recent_post_by_author">';
  $my_query = new WP_Query('author_name=Radek&showposts=2');
  while ($my_query->have_posts()) : $my_query->the_post(); ?>
  <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"> <?php the_title(); ?></a><BR>
  <?php endwhile;
  echo '</div>';
}
© Stack Overflow or respective owner