Pagination on a custom category page

Hello. I have created a custom archive layout for a category page and am having an issue with the pagination. It appears on the page, but doesn’t seem to advance the page. It is contained within the section of the page that contains the looper provider. I took a look at the video and documentation, but can’t figure out what I have missed.

Hello @501creative,

Thanks for writing to us.

I tried to access your site dashboard but unfortunately due to security reason, I am not able to access your site admin. I would suggest you to temporarily deactivate the security plugin or it would be best if you could copying your live website to your staging area. and send your details in a secure note so that we can investigate your setting without breaking your live site.

Thanks

I had forgotten they had that in place. I went ahead and just built it out on one of our test sites with the same result, so the error must lie with me and not the site. I see the the pagination element only appears when I add the consumer. Does it use the same provider as the posts themselves or does it need its own?

Howdy, @501creative! Thanks for that…I had a suspicion of what I thought might be happening and when I logged in I was able to confirm it. It seems that you turned on a Looper Provider set to Recent Posts on the Section surrounding all your content. I disabled this Provider and everything is now working as expected.

What is going on here is that the Looper Provider is really only needed if you’re trying to access a batch of content outside of the scope of a current query that won’t allow you to get to it. For example, if you were on your homepage but wanted to have a little section showcasing your 3 most recent posts, this is where you would use the Recent Posts provider because that page context in WordPress does not have access to those items with its default query.

When you are working on an archive layout that you plan on assigning to your Blog, once that assignment is created, the default WP_Query associated with that Layout is already your “recent posts,” so there’s no need to specify a Provider for this. This means that things like accessing posts and using pagination on these archive templates “just works” out of the box, but if you specify a Provider around that content, it will “break” the current query.

If you haven’t had a chance to do so already, I highly recommend you read through the documentation surrounding these features as these items are discussed in detail there, in addition to using our Starter Templates to see how we’ve wired up things and how they’re working there. That can help to give a better context for how you can repeat those patterns on your own to use for your personal builds…cheers!


Oh, that makes perfect sense. I watched the archive template video last and I think I just blanked out on the looper provider portion thinking I already understood it.

Thanks so much for the help.

You are most welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.