Support » Themes and Templates » No Next/Previous Page Button on my theme, Help adding one in please

  • Resolved kyledriffill



    Im using WordPress 2.7 standalone and my site is
    I have a theme installed but the next and previous page buttons are missing, if someone could help me add them in I would be very grateful, as I’ve read some similar posts but there solutions didn’t work.

    Any help would be very much appreciated.



Viewing 14 replies - 1 through 14 (of 14 total)
  • are you sure have this lines?

    <?php previous_posts_link(); ?>
    <?php next_posts_link(); ?>

    if so and still buttons are not showing up, go to your dashboard>>settings>>reading then set max number of posts showing up in a page to 1 then save settings then view your site.

    if the next/previous page buttons appear, that just means your previous setting was higher or equal to the number of posts you actually have.

    I’ve checked my main index template, if thats where the lines should be, there not, is it just as simple as pasting that code in?

    My settings are correct for the number or posts per page, I have quite alot, it’s just a new theme but definately can’t see them lines of code for next/previous page.

    search all your major files in our theme you should see those codes but there are some variations for that purpose like <?php posts_nav_link();?> yes its just that easy as pasting the code but there are also some parameters if you want to personalize gudlak!

    Right, I’ve been looking around, I cant find it anywhere or any simular variation.

    This is my Main Index Template, where abouts should the code be:

    <?php get_header();?>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <h2>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h2>

    <div class="post" id="post-<?php the_ID(); ?>">

    <div class="storycontent">
    <?php the_content(__('(more...)')); ?>
    </div><!--//end .storycontent//-->

    <div class="postcont">
    <h3><?php the_time('M'); ?><span>
    <?php the_time('j'); ?></span></h3>

    <div class="postfoot">
    <h1>Posted by: <span><?php the_author() ?></span></h1>
    <h1><?php _e("Filed under"); ?> <span><?php the_category(',') ?></span></h1>
    <span><?php wp_link_pages(); ?>
    <?php comments_popup_link(__('0'), __('1'), __('%')); ?></span></h1>
    </div><!--//end .postfoot//-->

    <div class="clear"></div>
    </div><!--//end .postcont//-->
    </div><!--//end .post//-->

    <?php comments_template(); // Get wp-comments.php template ?>
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    <?php get_footer(); ?>

    Thanks for the help 🙂

    as, where should i post the code to all the previous/next page buttons?

    put them at the bottom of this codes:

    <div class="storycontent">
    <?php the_content(__('(more...)')); ?>
    </div><!--//end .storycontent//-->

    Ive posted the codes in and I now have next/previous buttons, but there in every post, Ive left it as it is so you can see

    Do you know how I’d move it just so it’s at the bottom of the page as shown in the site link below instead of included in every post?

    just paste it anywhere you want in your file, trial and error don’t worry it won’t harm your theme ok?

    You’re getting the links in every post because you’re adding them in to the loop. The loop cycles through every single post repeating the same code, apart from the bits that change such as the post title and the post content.

    To put the next and previous buttons in before the loop starts (so above your posts) you need to put:

    <?php previous_posts_link(); ?>
    <?php next_posts_link(); ?>

    just before this bit:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    To do it after all your posts (after the loop finishes) you need to replace this:

    <?php endwhile; else: ?>

    with this:

    <?php endwhile; ?>
    <?php previous_posts_link(); ?>
    <?php next_posts_link(); ?>
    <?php else: ?>

    You can customise the previous and next links – read the Codex entry to see how to do this and other ways of creating previous and next links.

    THANKYOU very much, great help both of you, sorted it now 🙂

    great help…. very happy now



    Works well and looks great, Kyle.


    Hey gyes, I have a simmiliar problem :
    I read all you had done here, but it does’n help in this particular case!
    I dont have mine previos/next buttons on my main page, but only for a single post.
    How can I add them to the main page?!
    Here is the site:

    and my index.php file:

    <?php get_header(); ?>
    <div id=”content”>
    <?php if (have_posts()) : ?>
    <ul class=”post”>

  • <?php while (have_posts()) : the_post(); ?>
    <li id=”post-<?php the_ID(); ?>”>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?>

    <?php if ( function_exists(‘the_excerpt_reloaded’)) :?>
    <?php the_excerpt_reloaded(15, ”, ‘excerpt’, FALSE, ‘[more]’, FALSE, 1, TRUE); ?>
    <?php endif; ?>

    <?php endwhile; ?>

    <p class=”post”><?php next_posts_link(‘« Previous Entries’) ?></p>
    <p class=”post”><?php previous_posts_link(‘Next Entries »’) ?></p>

    <?php else : ?>
    <ul class=”post”>

  • Things change. What you’re looking for has probably been moved, changed, delted or *gasp* lost. While you’re here, though, why not have a look around?
  • <?php include (TEMPLATEPATH . “/searchform.php”); ?>
    <?php endif; ?>
    </div><!– end content –>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘No Next/Previous Page Button on my theme, Help adding one in please’ is closed to new replies.