php - wordpress pagination not showing -
i have custom query on wordpress page. query looks this:
$args = array( 'post_type' => array( 'tworca' ), 'orderby' => 'title', 'order' => 'asc', 'posts_per_page'=>12, 'post_parent' => 0 ); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args['paged'] = $paged; // query $the_query = new wp_query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); ... content of query..... } ?> <nav> <?php previous_posts_link('« newer') ?> <?php next_posts_link('older »') ?> <?php wp_pagenavi(); ?> </nav> <?php } else { echo 'no results'; } /* restore original post data */ wp_reset_postdata(); ?>
but pagination doesn't show. idea why? have read many posts similar problem, solution add 'paged' parameter wp query. , have parameter in query , doesn't help.
thanks in advance help!
please try adding query object wp_pagenavi(), like,
wp_pagenavi( array( 'query' => $the_query ) );
reference: http://scribu.net/wordpress/wp-pagenavi/wpn-2-74.html
Comments
Post a Comment