Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress From Bootstrap to WordPress Create Bootstrap Styled Theme Templates Create a Blog Archive Page

How do I set up a older posts page to show older posts (the next 10) still in order

Im not sure how to make it chose the previous ten posts on a page by with a button at the bottom that would normally read 'older posts' or 'previous'

Any tips or reading material for this?

I'm not sure if this is what you're referring to, but if you are trying to add older posts to your site and you want WP to put them in order by date (with the most recent on top), look to the right side of your screen when you are entering or editing your post. There is a category box "Publish". Open that box and toward the bottom you will see "Published on:" and beside it a date. At the end of that line should be an "Edit" link. Click that and WP will allow you to enter whatever date you want. Then save/update the page.

Hope this helps.

1 Answer

I think what you're referring to is something called 'Pagination'. Wordpress has it in its online codex, heres a snippet of what you should need.

<?php if ( have_posts() ) : ?>

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

<!-- the rest of your theme's main loop here -->

<?php endwhile; ?>

<!-- Add the pagination functions here. -->

<div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div>
<div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div>

<?php else : ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>

The amount of posts showing on each page will depend on yours settings under Settings > Reading in the WordPress admin dashboard.

Let me know how you go, hope this helps

Mike.

Thanks Mike!

Exactly what I wanted but my searches were too far off to find what I was looking for.