$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
	'category_name' => 'products',
	'orderby' => 'title',
	'order' => 'ASC',
	'posts_per_page' => '10',
	'paged' => $paged
);

$wp_query = new WP_Query( $args );

	if ( $wp_query->have_posts() ) {

		while ( $wp_query->have_posts() ) : $wp_query->the_post();
		//Do stuff
		endwhile; // end of the loop.

	wp_pagenavi( array( 'query' => $wp_query ) );
	wp_reset_postdata();
	}
Advertisements