Advertisement
salmancreation

Vaild - Pageunation WP

Jul 24th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1.  
  2. // Pagination
  3. function theme_name_pagination() {
  4.     global $wp_query;
  5.     if ( $wp_query->max_num_pages <= 1 ) return;
  6.     $big = 999999999; // need an unlikely integer
  7.     $pages = paginate_links( array(
  8.         'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
  9.         'format' => '?paged=%#%',
  10.         'current' => max( 1, get_query_var('paged') ),
  11.         'total' => $wp_query->max_num_pages,
  12.         'type'  => 'array',
  13.         'prev_text' => '<i class="flaticon-prev-1"></i>',
  14.         'next_text' => '<i class="flaticon-next-1"></i>',
  15.     ) );
  16.     if( is_array( $pages ) ) {
  17.         $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
  18.         echo '<div class="theme-pagination-one pt-15"><ul>';
  19.         foreach ( $pages as $page ) {
  20.             echo "<li>$page</li>";
  21.         }
  22.         echo '</ul></div>';
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement