skt_full_width_custom_blogpost_pagination

The SKT Full Width skt full width custom blogpost pagination function.

Description

skt_full_width_custom_blogpost_pagination( $wp_query ); 

Parameters (1)

0. $wp_query
The wp query.

Usage

  1. if ( !function_exists( 'skt_full_width_custom_blogpost_pagination' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4. // The wp query. 
  5. $wp_query = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = skt_full_width_custom_blogpost_pagination($wp_query); 
  9.  

Defined (1)

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

/functions.php  
  1. function skt_full_width_custom_blogpost_pagination( $wp_query ) { 
  2. $big = 999999999; // need an unlikely integer 
  3. if ( get_query_var('paged') ) { $pageVar = 'paged'; } 
  4. elseif ( get_query_var('page') ) { $pageVar = 'page'; } 
  5. else { $pageVar = 'paged'; } 
  6. $pagin = paginate_links( array( 
  7. 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),  
  8. 'format' => '?'.$pageVar.'=%#%',  
  9. 'current' => max( 1, get_query_var($pageVar) ),  
  10. 'total' => $wp_query->max_num_pages,  
  11. 'prev_text' => '« Prev',  
  12. 'next_text' => 'Next »',  
  13. 'type' => 'array' 
  14. ) );  
  15. if( is_array($pagin) ) { 
  16. $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged'); 
  17. echo '<div class="pagination"><div><ul>'; 
  18. echo '<li><span>'. $paged . ' of ' . $wp_query->max_num_pages .'</span></li>'; 
  19. foreach ( $pagin as $page ) { 
  20. echo "<li>$page</li>"; 
  21. echo '</ul></div></div>'; 
  22. }