damsean102
9/23/2014 - 10:03 AM

Quick Pagination

Quick Pagination

global $wp_query;
 $total = $your-WP-Query->max_num_pages;

if ( $total > 1 )  {
     // get the current page
     if ( !$current_page = get_query_var('paged') )
          $current_page = 1;
     
    //Set your Url Structure here
	if(!isset($_GET['product'])){
		$format = '?paged=%#%';
	}else{
		$format = '?product='.$_GET['product'].'&paged=%#%';
	}
	 
  
     echo paginate_links(array(
          'base'     => get_pagenum_link(1) . '%_%',
          'format'   => $format,
          'current'  => $current_page,
          'total'    => $total,
          'mid_size' => 4,
          'type'     => 'list'
     ));
}