Support » Themes and Templates » posts_nav_link

  • So I got this little code on a page called Blog

    <div id="content" role="main">
    		<?php
    		query_posts( 'cat=84&posts_per_page=4');
    		global $more;
    		$more = 0; ?>
    
    		 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    		<a href="<?php the_permalink(); ?>" title="<?php 	printf( esc_attr__( 'go to %s', 'twentyten' ), 	the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><h2> <?php the_title();?> </h2></a>
    		 <?php the_content(); ?>
    
    		 <?php endwhile; else: ?>
    		  <p>Sorry, no posts matched your criteria.</p>
    		 <?php endif; ?>
    	</div>

    Tryed some things to get the next en prev posts of category (blog) loaded. But I keep on getting the same posts and not the olders or newer ones.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    moderator

    Is this a static front page?

    Try it with pagination functions after the endwhile [untested]:

    <div id="content" role="main">
    		<?php
                    if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
    elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
    else { $paged = 1; }
    		query_posts( 'cat=84&posts_per_page=4&paged=' . $paged);
    		global $more;
    		$more = 0; ?>
    
    		 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    		<a href="<?php the_permalink(); ?>" title="<?php 	printf( esc_attr__( 'go to %s', 'twentyten' ), 	the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><h2> <?php the_title();?> </h2></a>
    		 <?php the_content(); ?>
    <?php endwhile; ?>
    <!-- pagination -->
    <?php next_posts_link(); ?>
    <?php previous_posts_link(); ?>
    <?php else : ?>
     <p>Sorry, no posts matched your criteria.</p>
    <?php endif; ?>
    </div>

    Yesss That did it. Thank you so much @keesiemeijer

    Moderator keesiemeijer

    (@keesiemeijer)

    moderator

    You’re welcome. I’m glad you got it resolved 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘posts_nav_link’ is closed to new replies.