• I have two blogs:

    http://www.miss-britt.com

    and

    http://www.miss-britt.com/photo

    I have been battling the previous/next post link issue for months.

    On my main blog, the “older” link shows up, but takes you back to the home page when you click it.

    The code on the main blog index.php file is:

    <?php endwhile; ?>
    
     <!--- the previous and next post links -->
    
    <div class="navigation"><p><?php posts_nav_link(); ?></p></div>
    
     <!--- closes the previous and next post links -->
    
    	<?php else : ?>

    I put the before/after php in to show you where in the template it is

    The link shows up, it says it’s linking to page 2 – but it takes you to the home page over and over again.

    On the individual posts I have tried

    <?php previous_post('&laquo; &laquo; %', '', 'yes'); ?>
    | <?php next_post('% &raquo; &raquo; ', '', 'yes'); ?>

    as well as previous_post_link

    NOTHING shows up on the individual post pages except the hash mark divider (it’s not there right now, just when I’m testing it)

    The navigation on the photo blog is

    <!-- BEGIN navigate -->
    <div id="navigate">
        <div id="navigate-inner" class="clearfix">
            <?php $wp_query->is_single = true; ?>
            <span class="previous"><?php previous_post('&lsaquo; %', '', 'yes', 'no'); ?></span>
            <span class="next"><?php next_post('% &rsaquo;', '', 'yes', 'no'); ?></span>
        </div>
    </div>
    <!-- END navigate -->

    Same thing – nothing shows up.

    There isn’t a single post page in that template.

    I’ve seen other people ask this question in the forums and get referred back to the codex. I feel like I have tried to implement the codex over and over again with no results.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Going to the first part of the main index.php – there should be the loop (are you familiar with that?) – can you post that? Should be something like this:

    <?php if (have_posts()) { ?>
      <?php while (have_posts()) : the_post();
        require("post.php");
      endwhile; ?>
    <?php } ?>

    If you have something that is specifically altering it looking for certain categories, or numbers of posts, it can interfere with the previous/next and needs a little bit extra to add in to fix.

    Also, another question, check the admin section and see how many posts you have set to show on the front page.

    Thread Starter missbritt

    (@missbritt)

    Thank you for looking!

    The loop section looks like this:

    <?php
       if (is_home()) {
          query_posts("cat=-300");
       }
    ?>  <!-- Excludes Category -->
    
    <!-- LOOP Starts Here -->
    
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    <!-- post title -->

    And then this is after the post content, comment data, etc:

    <?php endwhile; ?>
    
    <div class="navigation"><p><?php posts_nav_link(); ?></p></div>
    
    	<?php else : ?>

    The admin allows 10 posts on a front page.

    (The category excluded is for a thumbnail thing I’m doing in my sidebar)

    The Loop on the Photo blog is:

    <?php if (is_home()) { query_posts('showposts=1'); } ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <!-- BEGIN #photo -->

    Try this. On the loop (on either blog) change it so it looks like this:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    if (is_home()) {
      query_posts("cat=-300&paged=" . $paged . "");
    }

    Obviously for the photo one it would be

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    if (is_home()) {
      query_posts("showposts=1&paged=" . $paged . "");
    }

    See if that works.

    Thread Starter missbritt

    (@missbritt)

    Nope – through off crazy errors.

    I did find out on my photo blog that the links only disappear if you are logged into the site – which doesn’t make any sense to me either. *sigh*

    <?php if (is_home()) { $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; } query_posts(“paged=$paged&showposts=1”); ?>

    doo stuff

    <?php endwhile; ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Previous Post/Next Post links not showing across multiple templates’ is closed to new replies.