Template: how to show paginated posts?
-
I’ve just implemented
posts_nav_link();
after my gallery loop, but when I click “Previous Page” or “Next Page” it shows me the exact same gallery posts. How do I make it refresh the page with the previous or next posts? I’m sorry if I wasn’t clear enough.Here’s how my archive.php looks like:
<?php get_header(); ?> <?php get_template_part( 'loop', 'gallery' ); ?> <?php get_footer(); ?>
And here’s how my loop-gallery.php looks like:
<?php if (have_posts()) : ?> <?php query_posts('post_type=post&offset=0&posts_per_page=5'); ?> <ul class="gallery"> <?php while (have_posts()) : the_post(); ?> <li class="mosaic-block bar"> <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" class="mosaic-overlay"> <h3><?php the_title(); ?></h3> </a> <div class="mosaic-backdrop"> <?php if (has_post_thumbnail()) { $size = array(150, 150); the_post_thumbnail($size); } ?> </div> </li> <?php endwhile; ?> </ul> <?php posts_nav_link(); ?> <?php else : ?> <h4>Nothing Found</h4> <?php endif; ?>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Template: how to show paginated posts?’ is closed to new replies.