Created
August 26, 2015 16:16
-
-
Save celticwebdesign/5885ce99be958be6bcb6 to your computer and use it in GitHub Desktop.
Used on main archive page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// functions.php | |
// Pagination for paged posts, Page 1, Page 2, Page 3, with Next and Previous Links, No plugin | |
function html5wp_pagination() | |
{ | |
global $wp_query; | |
$big = 999999999; | |
echo paginate_links(array( | |
'base' => str_replace($big, '%#%', get_pagenum_link($big)), | |
'format' => '?paged=%#%', | |
'current' => max(1, get_query_var('paged')), | |
'total' => $wp_query->max_num_pages | |
)); | |
} | |
add_action('init', 'html5wp_pagination'); // Add our HTML5 Pagination | |
// HTML | |
<div class="archive-pagination"> | |
<?php get_template_part('pagination'); ?> | |
</div> | |
// CSS | |
.archive-pagination { | |
margin: 0; | |
padding: 0; | |
text-align: center; | |
} | |
.pagination { | |
display: block; | |
} | |
.pagination .prev { | |
float: left; | |
width: auto !important; | |
} | |
.pagination .next { | |
float: right; | |
width: auto !important; | |
} | |
.pagination .page-numbers { | |
display: inline-block; | |
height: 30px; | |
line-height: 30px; | |
width: 30px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment