wp_query and wp-navi
-
hi, i have a custom page template that has 2 wp-querys, the first one gets the first post then the second one gets the rest of them.
I need to add wp-page navi to the second but it seems my code is screwed, can someone help me out.get first post:
$page= get_query_var('page'); ?> <?php $featured = new WP_Query( array( 'posts_per_page' => 1 ) ); ?> <?php if ( $featured->have_posts() ) : ?> <?php while ( $featured->have_posts() ) : $featured->the_post(); ?> [my post code] <?php endwhile; ?> <?php else: ?> [no posts available at this time.] <?php endif; ?> <?php wp_reset_postdata(); ?>then i pull the rest of the posts
<?php $therest = new WP_Query( array( 'offset' => ( $page - 1 ) * 3, 'posts_per_page' => 3, 'paged' => $page ) ); ?> <?php if ( $therest->have_posts() ) : ?> <?php while ( $therest->have_posts() ) : $therest->the_post(); ?> [my post code] <?php endwhile; ?> <div class="navigation"><p><?php posts_nav_link(); ?></p></div> <?php wp_pagenavi( array( 'query' => $therest ) ); ?> <?php wp_reset_postdata(); ?> <?php else: ?> no posts currently available. <?php endif; ?>it pull the posts but the page nav shows the same results for the first 2 pages. Im pretty sure my query is incorrect so im hoping someone can help.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘wp_query and wp-navi’ is closed to new replies.