I am developing a theme and struggling with using a custom post query. I have created a meta box with a check box variable that allows the user to check the box to exclude the post from the blog. The intent is to give the user the option to include/exclude a post used for a feature slider, in the blog. The metabox key is 'kaex_metabox_exclude_post'.
Here is the abbreviated blog page code
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $args = array( 'post_status' => 'publish', 'meta_query' => array( array( 'key' => 'kaex_metabox_exclude_post', 'value' => 'on', 'compare' => '!=' ) ), 'paged' => $paged ); $wp_query -> query( $args); if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post(); ?> ......display posts <?php endwhile; <nav class="postpagenav"> <div class="left"><?php next_posts_link(__('<< older entries','ka_express') ); ?></div> <div class="right"><?php previous_posts_link(__(' newer entries >>','ka_express') ); ?></div> </nav> <?php } $wp_query = null; $wp_query = $temp; wp_reset_query(); else : endif; ?>
I've been able to get the query to work but not the pagination. Conversely the pagination works when I intentionally set the query to not work.
I've been working on this all day but just can't seem to get it to work.
Any help greatly appreciated.