<?php
echo paginate_links( array(
'mid_size' => 3,
'prev_text' => __( '« Prev', 'textdomain' ),
'next_text' => __( 'Next »', 'textdomain' ),
) );
?>
<?php
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' => get_pagenum_link(1) . '%_%',
'format' => 'page/%#%',
'total' => $numpages,
'current' => $paged,
'show_all' => False,
'end_size' => 1,
'mid_size' => $pagerange,
'prev_next' => True,
'prev_text' => __('« Previous'),
'next_text' => __('Next »'),
'type' => 'plain',
'add_args' => false,
'add_fragment' => ''
);
$paginate_links = paginate_links($pagination_args);
if ($paginate_links) {
echo "<div class='listing-pagination'>";
echo "<span class='pagination-nav'>".$paginate_links."</span>";
echo "</div><div class='divider div-transparent'></div>";
}
};
custom_pagination($query->max_num_pages,"",$paged);
?>