• Resolved nicgios

    (@nicgios)


    Hi all,
    I have a strange problem with next_posts_link and previous_posts_link. I created a custom post type and a simple archive page for it: no problems, everything works fine. But when I add next_posts_link and previous_posts_link they point only at the latest post (not showing the older ones).
    I googled and it seems to be a $paged variables problems and I tried to cut-paste code I found on the net (not the proper method, I know…) without results…

    Here is the code of my page archive for the type post “demandes”:

    <?php /* Template Name: Demandes Type Archive */ ?>
    
    <?php get_header(); ?>
    
    <div id="content-container">
     <div id="content" role="main">
    
    <?php
    
            global $query_string;
            query_posts("post_type=demandes&post_status=publish&posts_per_page=2");
            if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <h2><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    <?php the_excerpt(); ?>
    
    <?php endwhile; endif; ?>
    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('More ?'); ?></div>
    <div class="alignright"><?php previous_posts_link('? Previous'); ?></div>
    </div>
    <?php wp_reset_query(); ?>
    
      </div><!-- #content -->
    </div><!-- #content-container -->
    
    <?php get_sidebar();?>
    <?php get_footer();?>

    Thanks for your help

  • The topic ‘previous_posts_link not showing previous posts’ is closed to new replies.