custom loop: Index Pagination : Word Press


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <h3>Recent Articles</h3>
  2. <ul>
  3. <?php
  4. $temp = $wp_query;
  5. $wp_query= null;
  6. $wp_query = new WP_Query();
  7. $wp_query->query('showposts=5'.'&paged='.$paged);
  8. ?>
  9. <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
  10. <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
  11. <?php endwhile; ?>
  12. </ul>
  13. <div class="navigation">
  14. <div class="alignleft"><?php previous_posts_link('&laquo; Previous') ?></div>
  15. <div class="alignright"><?php next_posts_link('More &raquo;') ?></div>
  16. </div>
  17. <?php $wp_query = null; $wp_query = $temp;?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.