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

Joe Li
Joe Li
8,104 Points

Post Pagination in Wordpress

Hey Guys,

What's the most efficient way to add pagination to your blog posts?

Thanks,

Joe

2 Answers

Hey John,

It depends on what type of pagination you are looking for. You can do this by adding functions to your theme template, or a simpler solution would be to use a plugin.

Here is a plugin that should be able to achieve what you are looking for:

WP-PageNavi

This is what helped me:

"If you are looking for a bit more custom pagination, or do not want to implement it manually, there are a few plugins out there that can help. Perhaps the most popular is WP-PageNavi because it is easy to set up, easy to customize, and easy to style. As I mentioned before, themes from Elegant Themes are already set up to start using WP-PageNavi automatically, with built in PHP functions and CSS styles, so all you have to do is activate the plugin.

But if you are setting up the plugin on your own theme, you have to add a single function in place of your typical pagination.

<?php wp_pagenavi(); ?>

Then, you can use the plugin’s Settings page to customize every aspect of the pagination. Choose what text to display for next and previous links, when to show pagination, and the format of each section of pagination. WP-PageNavi will take these settings and output a full page navigation at the bottom of your pages, which tells users how many pages there are total, which page they are currently on, as well as links for next, previous, first and last pages. The plugin comes bundled with default styles, but you can remove this in the admin if you want to style it yourself."

Site credit: http://www.elegantthemes.com/blog/tips-tricks/how-to-add-pagination-to-wordpress

Let me know if this works for you!

Josiah Richards

Adarsh Prabhu
Adarsh Prabhu
15,394 Points

I tried this. It doesn't work