Support » Themes and Templates » Paged Post

  • Resolved MaddTechWF

    (@maddtechwf)


    How would I go about creating a page that shows the last 5 posts and then has a next/previous buttons?

Viewing 1 replies (of 1 total)
  • <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('page_per_posts=5&paged=' . $paged);
      if(have_posts()) :
        while(have_posts()) :
          the_post();
          ?>
          <a href="<? the_permalink(); ?>"><?php the_title() ?></a>
          <div class="entry"><?php the_content(); ?></div>
          <?php
        endwhile;
        ?>
        <div class="navigation">
          <div class="alignleft"><?php previous_posts_link('&laquo; Newer') ?></div>
          <div class="alignright"><?php next_posts_link('Older &raquo;') ?></div>
        </div>
        <?php
      endif;
    wp_reset_query();
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Paged Post’ is closed to new replies.