Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm doing a custom query using WP_query to get posts from a specific category, but for some reason navigation links for the list don't appear. Is there a way to get the newer/older links to show up and work using a custom WP_query?

This is what I'm doing:

<?php $mainList_query = new WP_Query('cat=4,352,731,754,49,44,54,17&showposts=200&order=DESC'); ?>
<?php if($mainList_query->have_posts()) : while($mainList_query->have_posts()) : $mainList_query->the_post(); ?>

   <div class="articleSection">

            <h2 class="headlinelist"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <div class="byline2"><?php the_time('F jS, Y') ?> by <?php the_author() ?> at <?php the_time() ?> </div>
    <?php if ( in_category( array(754,49,44,54,17) ) ) { ?>
    <img src="<?php bloginfo('template_url'); ?>/images/360btn.jpg" width="67" height="16" alt="" />
    <?php } ?>
    <?php if ( in_category(4) ) { ?>
    <img src="<?php bloginfo('template_url'); ?>/images/ps3btn.jpg" />
    <?php } ?>
    <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?></p>
   </div>


  <?php endwhile; ?>


  <div class="navigation">

   <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>

   <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>

  </div>


 <?php else : ?>

  <h2 class="center">Not Found</h2>

  <p class="center">Sorry, but you are looking for something that isn't here.</p>

  <?php get_search_form(); ?>


 <?php endif; ?>
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

try adding '&paged='.$paged to your query string

<?php $mainList_query = new WP_Query('cat=4,352,731,754,49,44,54,17&showposts=200&order=DESC&paged='.$paged); ?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.