• Hi, I’m new on wordpress theme development.
    I’m trying to add pagination on single.php by adding this code.

    <div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div>
    <div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div>

    But it’s not showing.

    my single.php is like this:

    `<div id=”content”>
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

    <article>

    <h2><?php the_title(); ?></h2>
    <p class=”small”><time datetime=”<?php the_time( ‘Y-m-d’ ); ?>” pubdate><?php the_date(); ?></time> – Written by <a href=”<?php get_the_author_link(); ?> “><?php the_author(); ?></a> – <?php comments_popup_link(‘Leave a Comment’, ‘1 Comment’, ‘% Comments’); ?></p>
    <?php the_content(); ?>
    <p class=”small”>Category: <?php the_category(‘, ‘) ?> &nbsp&nbsp&nbsp <?php the_tags() ?></p>
    <?php if ( get_the_author_meta( ‘description’ ) ) : ?>
    <?php echo get_avatar( get_the_author_meta( ‘user_email’ ) ); ?>
    <h3>About <?php echo get_the_author() ; ?></h3>
    <?php the_author_meta( ‘description’ ); ?>
    <?php endif; ?>

    <?php comments_template( ”, true ); ?>

    </article>
    <?php endwhile; ?>
    </div>`

    I try to put the code everywhere but it isn’t work.
    Anyone can help?

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Pagination doesn't work on single.php’ is closed to new replies.