Posted By

S_Park on 07/30/10


paging wordpress

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


Wordpress: Conditional page navigation

 / Published in: PHP

Only show page navigation when necessary (ie when there is more than on page of results)

  1. <?php global $wp_query;
  2. if ($wp_query->max_num_pages > 1) { ?>
  3. <div class='navigation'>
  4. <span class='older'><?php next_posts_link('&laquo; Older Entries'); ?></span>
  5. <span class='newer'><?php previous_posts_link('Newer Entries &raquo;'); ?></span>
  6. </div>
  7. <?php } ?>

Report this snippet  

You need to login to post a comment.