• Resolved ericbowers

    (@ericbowers)


    I’m using a template called Nishita – for photo blogging. In Options > Reading I have it set to Show at Most 10 posts. However, the Previous and Next nav buttons will only show a single post at a time. Can someone help me out here on getting the navlinks to show ten posts? For instance, after a reader views the latest ten posts on the front page, the reader can click Previous at the bottom and be shown the older ten posts. It sounds pretty simple but I’ve had no luck with this.

    LINK to my site

    Here is my template’s index.php code:

    <?php get_header(); ?>
    
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <!-- BEGIN #photo -->
    <h2 class="photo-title"><span><?php the_title(); ?></span></h2>
    <div id="photo"><div id="photo-inner">
    <?php the_content(); ?>
    </div></div>
    <!-- END #photo -->
    
    <!-- BEGIN photo meta -->
    <div id="photo-meta"><div id="photo-meta-inner">
    <ul>
    <li><?php the_time('F jS, Y') ?></li>
    <li><?php the_category(', ') ?></li>
    <?php $wp_query->is_single = false; ?>
    <li><?php comments_popup_link('No comments', '1 comment', '% comments','Comments closed'); ?></li>
    <li><a href="<?php the_permalink() ?>" title="Permanent Link to '<?php the_title(); ?>'">#</a></li>
    </ul>
    </div></div>
    <!-- END photo meta -->
    
    <!-- BEGIN navigate -->
    
    <div id="navigate"><div id="navigate-inner" class="clearfix">
    <?php $wp_query->is_single = true; ?>
    <span class="previous"><?php previous_post( '%', 'Previous', '' ) ?></span>
    <span class="next"><?php next_post( '%', 'Next', '' ) ?></span>
    </div></div>
    
    <!-- END navigate -->
    <?php endwhile; ?>
    <?php endif ?>
    
    <?php get_footer(); ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • Eric,

    You could try:

    <div class="postNavigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Previous News') ?></div>
    			<div class="alignright"><?php previous_posts_link('Next News &raquo;') ?></div>
    		</div>

    right after:

    <!-- END navigate -->
    <?php endwhile; ?>
    <?php endif ?>

    The navigation links that you have currently work on a “per post” basis. Basically, they get either the post right before, or the post right after the current post. Try these other links and let me know how it works for you.

    -Mike

    Thread Starter ericbowers

    (@ericbowers)

    Thanks for the tip Mike. Unfortunately no change however. Might I need to specify somehow to show the next ten posts numerically?

    I appreciate the help.

    This will work…
    At least on WP 2.5 RC1 – but should work for you too.
    The trick is this line: $wp_query->is_single = false; Your theme sets it to true to get previous_post() and next_post() to work. We need to set it back to get the other links working. Please let me know how this works for you.
    -Mike

    <!-- END navigate -->
    <?php endwhile; ?>
    
    <?php $wp_query->is_single = false; ?>
    <div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    		</div>
    <?php endif; ?>
    Thread Starter ericbowers

    (@ericbowers)

    Afraid that still didn’t do it. Although I’ll note that your suggestions are not crashing my website like my own alterations were doing. If you’ve got any more ideas, I’m listing. Thanks Mike.

    Thread Starter ericbowers

    (@ericbowers)

    Oh my God Mike, you’re gonna kill me. Your solution actually worked – I just wasn’t accustomed to looking in the right place on my site.

    Thanks!

    Nope…. I don’t kill anybody ??
    Glad it worked out for you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Getting navlink to show multiple previous posts’ is closed to new replies.