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 trialAlex Plaza
22,923 PointsHow to add pagination to a Wordpress Custom Post.
Hi, I'm using the plugin Custom Post Types recomended by Zac on "How to make a wordpress theme" Course. (I'm also using everything as he indicate on the course, because I' new in wordpress development, and because he pointed out some best practices.)
The thing is I'm having trouble with adding a pagination to the custom post types, I search on google and I try several solutions for this, but non of them seems to fit on my project. Any idea how to add the pagination to a custom post on a theme based on Zac's course?
5 Answers
Zac Gordon
Treehouse Guest TeacherHave you tried this one? http://css-tricks.com/snippets/wordpress/paginate-custom-post-types/
Andrew McCormick
17,730 PointsAlex, What does your template for the custom post look like? It should just be a matter of add this after your while loop:
<nav>
<?php previous_posts_link('« Newer') ?>
<?php next_posts_link('Older »') ?>
</nav>
Alex Plaza
22,923 PointsThanks guys, I have been a little busy, soon I will check your answers. But I'm pretty sure I tried the first one and it didn't work. Anyway, thanks!
Alex Plaza
22,923 PointsThanks guys, I have been a little busy, soon I will check your answers. But I'm pretty sure I tried the first one and it didn't work. Anyway, thanks!
Gonzaloº Caminos
2,231 PointsHi. I need implement a pagination system in my Foundation template... but the problem is that the code is:
ul class="pagination text-center" role="navigation" aria-label="Pagination">
<li class="pagination-previous disabled">Previous</li>
<li class="current"><span class="show-for-sr">You're on page</span> 1</li>
<li><a href="#" aria-label="Page 2">2</a></li>
<li><a href="#" aria-label="Page 3">3</a></li>
<li><a href="#" aria-label="Page 4">4</a></li>
<li class="ellipsis"></li>
<li><a href="#" aria-label="Page 12">12</a></li>
<li><a href="#" aria-label="Page 13">13</a></li>
<li class="pagination-next"><a href="#" aria-label="Next page">Next</a></li>
</ul>