WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Previous page not showing previous posts in custom Loop (2 posts)

  1. Doug
    Member
    Posted 4 years ago #

    I'm working on a template page which will do the following:

    Display the title and content of that page.
    Display an index of sorts with the posts of a related post type.

    The reason is that not only do I want an index of my custom post type, I also want a customizable opening bit that's constant on the page.

    So far, here's the code I have:

    <? get_header();?>
    
    <div id="content">
    <? the_post();?>
         <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
              <h1><? the_title();?></h1>
              <div id="page-content"><? the_content(); ?></div>
    
              <?php query_posts('post_type=episode');
                        if($wp_query->max_num_pages>1) :
                             /* Display navigation to next/previous pages when applicable */?>
                             <div id="nav-above" class="navigation">
                                  <div class="nav-previous"><?php next_posts_link(); ?></div>
                                  <div class="nav-next"><?php previous_posts_link(); ?></div>
                             </div><!-- #nav-above -->
                        <? endif;
                        while($wp_query->have_posts()) : $wp_query->the_post();?>
                        <ul class="episode-content">
                             <li><?php the_title( '<h2><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>' ); ?>
                        <ul class="entry-content">
                             <?php rg_get_episode_preview(); ?>
                             <?php edit_post_link( __( 'Edit', 'twentyten' ), '<li class="edit-link">', '</li>' ); ?>
                        </ul><!--.entry-content-->
                   </li>
              </ul>
              <?php endwhile; ?>
              <?php /* Display navigation to next/previous pages when applicable */
              if (  $wp_query->max_num_pages > 1 ) : ?>
                   <div id="nav-below" class="navigation">
                        <div class="nav-previous"><?php next_posts_link(); ?></div>
                        <div class="nav-next"><?php previous_posts_link(); ?></div>
                   </div><!-- #nav-below -->
              <?php endif;
              wp_reset_query();?>
    </div>
    </div><!--#content-->
    
    <? get_sidebar();?>
    <? get_footer();?>

    That's essentially it. Everything works fine and dandy except when you click on previous/next, it lists the same 5 posts.

    Ideas anyone? Alternatively, how do I designate an index page for a particular post type/custom taxonomy? It might be better but I was hoping to have the opening bit modifiable.

  2. Doug
    Member
    Posted 4 years ago #

    Disregard, after further searching I found the answer in this post:

    http://wordpress.org/support/topic/next-page-button-not-displaying-older-posts

Topic Closed

This topic has been closed to new replies.

About this Topic