Navigation links broken when using custom query
-
I have am taking over a site and building a blog portion for a client, Posts are being used for multiple different things, but my question relates specifically to the blog portion:
Scenario 1
<?php $blog = new WP_Query(); ?> <?php $blog->query("cat=21&orderby=date&posts_per_page=3"); ?> <?php if ($blog->have_posts()) : ?> <?php while ($blog->have_posts()) : $blog->the_post(); ?>
This is the query used, and everything works fine except the page navigation links disappear, I can use another query where the navigation links work, but my comments don’t.
Scenario 2
<?php if (have_posts()) : ?> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=21&paged=$paged&posts_per_page=3&orderby=date"); ?> <?php while (have_posts()) : the_post(); ?>
I think scenario 1 might be easier to solve?
Basically, the blog portion needs to have ONLY posts from category 21, -or- its children (I can work with either.)
AND
Only 3 posts per page (this needs to be different from the reading settings page, which is set to 70, although setting it to 3 made no difference)
- The topic ‘Navigation links broken when using custom query’ is closed to new replies.