WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Query Page + Query Posts. Next and Previous Post links not working properly. (2 posts)

  1. berchman
    Member
    Posted 6 years ago #

    Hi,
    I have some custom pages that first call for page content, then the custom pages call for posts from a specific category.

    Problems:

    1. The 'Previous Posts' and 'Next Posts' links are showing up after every post.
    2. When clicking on 'Previous Posts' or 'Next Posts' I get the same first 7 posts. There are 10 there. I am not truly 'seeing' the second page. However, the link does change from 'Previous' to 'Next'

    Here is the PHP being used for this:

    <?php $page_62 = new WP_Query('page_id=62'); $page_62->the_post(); ?>
    <h1><span><?php the_title(); ?></span></h1>
    <?php the_content( ); ?>
    
    <?php if(have_posts()) : ?>
      <?php query_posts('cat=12&order=ASC'); ?>
      <?php while(have_posts()): the_post(); ?>
         <h3><span><?php the_title(); ?></span></h3>
         <?php the_content( ); ?>
    
      <div class="navigation">
        <div class="alignleft"><?php next_posts_link('Previous Posts') ?></div>
        <div class="alignright"><?php previous_posts_link('Next Posts') ?>
      </div>
    </div>		
    
    <?php endwhile; ?>
      <?php else : ?>
        <p>There are currently no Small Dogs available for adoption.</p>
        <?php include (TEMPLATEPATH . "/notfound.php"); ?>
    <?php endif; ?>

    Any help on this would be greatly appreciated.

  2. berchman
    Member
    Posted 6 years ago #

    I found another topic that addresses this issue perfectly. Hopefully this will help someone.

Topic Closed

This topic has been closed to new replies.

About this Topic