Skip to content

Instantly share code, notes, and snippets.

@joldnl
Created July 23, 2014 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joldnl/939e3ac616b5bbc3ca6f to your computer and use it in GitHub Desktop.
Save joldnl/939e3ac616b5bbc3ca6f to your computer and use it in GitHub Desktop.
WP Pagination
.pagination {
position: relative;
text-align: center;
font-size: 16px;
padding-top: 20px;
padding-bottom: 20px;
a,
.dots,
.current {
font-family: "Arial Black";
font-size: 20px;
font-weight: bold;
text-align: center;
text-decoration: none;
width: 40px;
display: inline-block;
background: @clrGrayDark;
color: @clrRed;
border: 0px;
margin: 0px 2px 0px 2px;
padding: 10px 0px 10px 0px;
&:hover {
// background: @clrGray !important;
color: @clrWhite;
}
}
.prev {
.sprite(-288px, -192px);
background-color: @clrGrayDark;
text-indent: -999999px;
}
.next {
.sprite(-287px, -92px);
background-color: @clrGrayDark;
text-indent: -999999px;
}
.current {
font-weight: bold;
display: inline-block;
// background: @clrGreen !important;
text-align: center;
color: #FFF;
border: 0px;
background: @clrRed;
color: #FFF;
&:hover {
// background: @clrGreen !important;
color: #FFF;
}
}
}
<?php
global $wp_query;
$big = 999999999; // need an unlikely integer
$paginate_args = array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'prev_text' => "&laquo;",
'next_text' => "&raquo;",
);
if(paginate_links($paginate_args) != "") {
?>
<div class="pagination">
<?php echo paginate_links($paginate_args); ?>
</div>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment