onetone_native_pagenavi

Page navigation.

Description

onetone_native_pagenavi( $echo, $wp_query ); 

Parameters (2)

0. $echo
The echo.
1. $wp_query
The wp query.

Usage

  1. if ( !function_exists( 'onetone_native_pagenavi' ) ) { 
  2. require_once '/includes/theme-functions.php'; 
  3.  
  4. // The echo. 
  5. $echo = null; 
  6.  
  7. // The wp query. 
  8. $wp_query = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = onetone_native_pagenavi($echo, $wp_query); 
  12.  

Defined (1)

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

/includes/theme-functions.php  
  1. function onetone_native_pagenavi($echo, $wp_query) { 
  2.  
  3. if(!$wp_query) {global $wp_query;} 
  4. global $wp_rewrite;  
  5. $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1; 
  6. $pagination = array( 
  7. 'base' => @add_query_arg('paged', '%#%'),  
  8. 'format' => '',  
  9. 'total' => $wp_query->max_num_pages,  
  10. 'current' => $current,  
  11. 'prev_text' => '<i class="fa fa-angle-double-left"></i>',  
  12. 'next_text' => '<i class="fa fa-angle-double-right"></i>',  
  13. 'type' => 'list',  
  14. ); 
  15.  
  16. if( $wp_rewrite->using_permalinks() ) 
  17. $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg('s', get_pagenum_link(1) ) ) . 'page/%#%/', 'paged'); 
  18.  
  19. if( !empty($wp_query->query_vars['s']) ) 
  20. $pagination['add_args'] = array('s'=>get_query_var('s')); 
  21. if($echo == "echo") { 
  22. echo '<div class="page_navi post-list-pagination text-center">'.paginate_links($pagination).'</div>';  
  23. }else 
  24.  
  25. return '<div class="page_navi post-list-pagination text-center">'.paginate_links($pagination).'</div>';