How to work with pagination?

Hello everyone!

I’ve just discovered Frontity and I’m considering using it in my next projet. However, I couldn’t understand how I would implement a pagination for a custom post type for example. Am I able to query limited amounts of posts and also get the total amount of posts registered?

Hi @andredias.us

Welcome to the Frontity community. Great to hear that you’re planning to use Frontity in your next project.

When you list posts of any type, including Custom Post Types, if there’s more posts than is defined in state.source.params.per_page for a given post type (if it’s not defined it defaults to 10) then the data for that post type will have a next property with the URL for the next page as it’s value. See here for more on this.

For a more detailed explanation see this page in our new step-by-step tutorial. The information there will apply to CPTs as well as to regular posts.