WordPress.org

Forums

next/previous posts not working (5 posts)

  1. mrwolfy
    Member
    Posted 5 years ago #

    I have got my page working. The page displays posts from one category only. Now my problem is that the next page does not display the next page, rather it displays the same six posts that were displayed on the previous page, while the URL reads:http://owolf.com/home/art/page/2/

    perhaps I am missing something fundamental. And it is not possible to mix the query post style of PHP I have with the next_post_link tag? If you have any insight on this please help!

    Thanks!

    <?php
    /*
        Template Name:  my page template
    
    */
    
    ?>
    
    <?php get_header(); ?>
    
    <div class="contentWrapper">
    
    <div class="push"></div>
    
    <div class="container">
    
    <?php if(have_posts()) : ?><?php query_posts('cat=4'); while (have_posts()) : the_post();?>
    
    				<div class="entry">
    					<?php the_content(); ?>
    				</div>
    
    				 <p class="postmetadata"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?> | </a> Posted <?php the_time('F jS, Y') ?> | Category "<?php the_category(', ') ?>" <?php edit_post_link('| Edit','',''); ?> </p>
    
    	<?php endwhile; ?>
    
    	<?php else: ?>
    
    		<div class="post" id="post-<?php the_ID(); ?>">
    			<h2><?php _e('Not Found'); ?></h2z>
    		</div>
    
    	<?php endif; ?>
    
    </div>
    
    </div>
    
    <div class='navigation'>
      <span class='older'><?php next_posts_link('&laquo; Older Entries') ?></span>
      <span class='newer'><?php previous_posts_link('Newer Entries &raquo;') ?></span>
    </div>
    
    <!--END  CONTENT!-->	
    
    <div class="push"></div>
    
    </div>
    
    <?php get_footer(); ?>
    
    </body>
    </html>
  2. Peter Boosten
    Member
    Posted 5 years ago #

    Hmmm, the url displays http://owolf.com/home/category/art/page/2/
    which seems to be correct.

    Peter

  3. mrwolfy
    Member
    Posted 5 years ago #

    right, but the content is incorrect, ie it is just the same content as the previous page.

  4. Peter Boosten
    Member
    Posted 5 years ago #

    On that particular link I get only one post (with this title 'OWOLF 2 | Posted December 7th, 2009 | Category "Art, Painting" '), while the previous page shows five.

    Peter

  5. mrwolfy
    Member
    Posted 5 years ago #

    right, that's correct, because i changed from pages, as the code above will generate, to categories to fix the issue. Categories work perfectly for me.

    thanks for your interest.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.