WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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>

  <?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>


 <?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
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

Your Answer


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