Pagination problem (Not showing next and previous link) (1 post)

  1. kalpitpandit
    Posted 2 years ago #

    i am newbie in wordpress. i am referring link for pagination and trying to put next and previous link to posts list. but i am not getting next and previous link in my page.

    What's going wrong in my code?

    <?php get_header(); ?>
    <h2>Hi this is index file</h2>
    <h1> Post List</h1>
    <?php if(have_posts()): while (have_posts()) : the_post() ?>
    <h2> <?php the_title(); ?> </h2>
    <h3> <?php the_author(); ?> </h3>
    <?php the_content(); ?>
    <?php endwhile; ?>
    <div class="nav-previous alignleft"><?php posts_nav_link(); ?></div>
    <?php else :?>
    <?php _e("Sorry ! No post available"); ?>
    <?php endif;?>
    <strong><?php posts_nav_link(); ?></strong>
    /*<div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div>
    <div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div>*/
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    i think i kept posts_nav_link() in wrong place.

    Thanks in advance

Topic Closed

This topic has been closed to new replies.

About this Topic