Closed
Description
Hey Ben,
The default post navigation uses the standard, boring Older Posts or Newer Posts
<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php if ($wp_query->max_num_pages > 1) { ?>
<nav id="post-nav" class="pager">
<div class="previous"><?php next_posts_link(__('← Older posts', 'roots')); ?></div>
<div class="next"><?php previous_posts_link(__('Newer posts →', 'roots')); ?></div>
</nav>
<?php } ?>
Referencing http://wp.tutsplus.com/tutorials/wordpress-pagination-a-primer/ I think a much more usable alternative would be the following:
<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php
global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
echo '<div class="page_nav">';
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => 'page/%#%',
'current' => $current_page,
'total' => $total_pages,
'prev_text' => 'Prev',
'next_text' => 'Next'
));
echo '</div>';
}
?>
As it states in the article, this will put both Prev, Next and page numbers as well.
I know I keep throwing these code changes at you - I'll sit down and learn how to properly do these through GitHub soon :)