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

Pagination (next_posts_link/previous_posts_link/pagination_links) in combination with advanced custom fields and custom post types in wp

Does anybody know a few resources in regards of pagination in wp in combination with advanced custom fields and custom post types?

in a wordpress project i've set up a custom post type based on advanced custom fields which mimic more or less exactly the general wp posts functionality with the difference that i am more flexible in regards of image handling, responsive images in particular. but on the downside i was unable to get the native wp pagination functions (next_posts_link/previous_posts_link/pagination_links) with acf and custom post type working. if someone has a recommendable link to read i would appreciate cuz so far my research on the net wasn't that successful. :/ best regards r.

1 Answer

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Hi,

If you use the same pagination code with your normal home.php or blog post listing page does the pagination work? I want to make sure that the code you're using works in a normal setting, just not with the custom fields.

I assume that you've looked at all the WP_Query functions regarding pagination? You might want to check out this post on CSS Tricks as well as read the comments, which have some trouble shooting techniques: http://css-tricks.com/snippets/wordpress/paginate-custom-post-types/

Hope that helps!