corsonr
1/5/2013 - 4:57 PM

WP_query wp_posts only

WP_query wp_posts only

<?php
 
// Create a new Query
$args = array(
         'post_type' => 'post',
          'posts_per_page' => 5,
          'update_post_term_cache' => false, // don't retrieve post terms
          'update_post_meta_cache' => false, // don't retrieve post meta
          );
$the_query = new WP_Query( $args );
 
// The Loop
echo '<ul>':
while ( $the_query->have_posts() ):
  $the_query->the_post();
  echo '<li>' . get_the_ID() . '</li>';
endwhile;
echo '</ul>':
 
// Restore original Query
wp_reset_query();
 
?>