Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.