Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ***** for functions.php *****
- // custom pagination
- function custom_pagination($numpages = '', $pagerange = '', $paged='') {
- if (empty($pagerange)) {
- $pagerange = 2;
- }
- global $paged;
- if (empty($paged)) {
- $paged = 1;
- }
- if ($numpages == '') {
- global $wp_query;
- $numpages = $wp_query->max_num_pages;
- if(!$numpages) {
- $numpages = 1;
- }
- }
- $pagination_args = array(
- 'base' => add_query_arg('paged','%#%'),
- 'format' => '',
- 'total' => $numpages,
- 'current' => $paged,
- 'show_all' => False,
- 'end_size' => 1,
- 'mid_size' => $pagerange,
- 'prev_next' => True,
- 'prev_text' => __('«'),
- 'next_text' => __('»'),
- 'type' => 'plain',
- 'add_args' => false,
- 'add_fragment' => ''
- );
- $paginate_links = paginate_links($pagination_args);
- if ($paginate_links) {
- echo "<nav class='custom-pagination'>";
- echo "<span class='page-numbers page-num'>Page " . $paged . " of " . $numpages . "</span> ";
- echo $paginate_links;
- echo "</nav>";
- }
- }
- ****** css
- /* ============================================================
- CUSTOM PAGINATION
- ============================================================ */
- .custom-pagination span,
- .custom-pagination a {
- display: inline-block;
- padding: 2px 10px;
- }
- .custom-pagination a {
- background-color: @brown;
- color: @links;
- }
- .custom-pagination a:hover {
- background-color: @brightRed;
- color: @altWhite;
- }
- .custom-pagination span.page-num {
- margin-right: 10px;
- padding: 0;
- color:@white;
- font-weight:200;
- }
- .custom-pagination span.dots {
- padding: 0;
- color: gainsboro;
- }
- .custom-pagination span.current {
- background-color: @darkSubMeta;
- color: @altWhite;
- }
- ******* for templates - make sure this is included before wp_reset_postdata(); and change the var from $multimedia to whatever your query was called.********
- if (function_exists(custom_pagination)) {
- custom_pagination($multimedia->max_num_pages,"",$paged);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement