Monday, March 11, 2019

WP custom pagination

Code:

<?php$args = array(    'show_all'           => false,    'prev_next'          => true,    'prev_text'          => __('« Previous'),    'next_text'          => __('Next »'),    'type'               => 'array');
$pages = paginate_links( $args );
if( is_array( $pages ) ) {    $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');    echo '<div class="pagination-wrap"><ul class="pagination">';    foreach ( $pages as $page ) {        echo "<li>$page</li>";    }    echo '</ul></div>';}

?>

No comments:

Post a Comment