advantage_content_nav_link

Pagination.

Description

advantage_content_nav_link( $num_of_pages, $nav_id ); 

Parameters (2)

0. $num_of_pages
The num of pages.
1. $nav_id
The nav id.

Usage

  1. if ( !function_exists( 'advantage_content_nav_link' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4. // The num of pages. 
  5. $num_of_pages = null; 
  6.  
  7. // The nav id. 
  8. $nav_id = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = advantage_content_nav_link($num_of_pages, $nav_id); 
  12.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function advantage_content_nav_link( $num_of_pages, $nav_id ) { 
  2. if ( $num_of_pages > 1 ) { 
  3. echo '<nav id="' . $nav_id . '">'; 
  4. echo '<div class="pagination pagination-centered">'; 
  5.  
  6. $big = 999999999; 
  7. if ( get_query_var( 'paged' ) ) 
  8. $current_page = get_query_var( 'paged' ); 
  9. elseif ( get_query_var( 'page' ) )  
  10. $current_page = get_query_var( 'page' ); 
  11. else  
  12. $current_page = 1; 
  13. $links = paginate_links( array( 
  14. 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),  
  15. 'format' => '?paged=%#%',  
  16. 'current' => max( 1, $current_page ),  
  17. 'total' => $num_of_pages,  
  18. 'mid_size' => 3,  
  19. 'prev_text' => '<i class="icon-chevron-left"></i>' ,  
  20. 'next_text' => '<i class="icon-chevron-right"></i>' ,  
  21. 'type' => 'array' ) ); 
  22. echo '<ul><li><span>' . __( 'Page', 'voyage' ) . '</span></li>'; 
  23. foreach ( $links as $link ) 
  24. printf( '<li>%1$s</li>', $link ); 
  25. echo '</ul></div></nav>';