WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] posts_nav_link(); not working

[Resolved] posts_nav_link(); not working

  • laurencescott

    @laurencescott

    Hi Everyone,

    I am completely new to WordPress and I am learning how to develop my own themes.

    I have attempted to create pagination with the posts on my font page but it just displays the same posts on each page.

    Here is my code:

    <?php query_posts("posts_per_page=5"); ?>
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    		<a class="posttitle" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
    
    		<p><?php the_excerpt(); ?></p>
    
    		<?php endwhile; ?>
    
    		<div id="previousandnext"><p><?php posts_nav_link(); ?></p></div>
    
    		<?php else : ?>
    
    		<h2>Not Found</h2>
    
    		<?php endif; ?>

    Does anyone have any idea what I am doing wrong?

    Thanks in advance 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] posts_nav_link(); not working’ is closed to new replies.
Skip to toolbar