I'm having a strange issue on a blogpage that I'm working on. I have created an index.php page with a loop that display's only a specific category of posts. It also displays the next and previous posts links when needed. All fine.

I've copied that loop with into a new template page and modified the loop to display a different category of posts. But this time the next and previous posts links are not displayed on the page.

How is that possible?

This is the loop on the template page:

<?php  $custom_query = new WP_Query ('cat=4&order=DEC&paged='.$paged);?>

<?php if ($custom_query->have_posts()) : while ($custom_query->have_posts()) :     
$custom_query->the_post();  ?>


<h2><a href="<?php the_permalink (); ?>"><?php the_title (); ?></a></h2>

<div class="meta"><p><i class="icon-calendar"></i> Published on: 
<?php the_time('j F Y'); ?> | <i class="icon-pencil"></i> Author: <?php the_author(); ?>   

<?php the_content(); ?>         


<?php endwhile; ?>

<div class="pagenation d-1-2 t-all m-all">

<?php next_posts_link('<i class="icon-circle-arrow-left"></i> Previous posts') ?> 
<?php previous_posts_link('Next posts <i class="icon-circle-arrow-right"></i>') ?>
  • Please don't use native strings. Replace them with proper English so everybody can read and understand your example fully.
    – kaiser
    Apr 26, 2013 at 13:08
  • Edited the native strings to English and replaced the loop with the solution that can be found at the question right at the top of my own question. Was already aware that using query_posts wasn't the best solution. Thanks for linking to the similair question.
    – NielsPilon
    Apr 27, 2013 at 13:47


Browse other questions tagged or ask your own question.