<?php $recentPosts = new WP_Query(); $recentPosts->query(’showposts=5’); ?> <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?> <!– do some stuff here –> <?php endwhile; ?> With Pagination: <?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query(’showposts=5′.’&paged=’.$paged); ?> <!– do some stuff here –> <?php $wp_query = null; $wp_query = $temp; ?>
Tag: loop
Exclude categories from index loop
<?php $posts=query_posts($query_string . ‘&cat=-6’); if (have_posts()) : while (have_posts()) : the_post(); ?>