Hi! I want to create a loop with my custom post type posts. All working fine, i fetch my posts beforeSSR and i’m able to use that on homepage.
Unfortunately there’s only 10 posts display in my loop and the others post are in the next page. I want to display all post in one page. Some suggestions?
Thtat’s my code in index.js
you can only see 10 posts because that is the default amount returned by wordpress as part of an API request. There are few ways you can adjust this. For example, you can pass per_page as a param to the request or you can adjust in the frontity settings, how many items are being requested for your CPT.
Sorry for bumping an old thread, I’m looking at this because I’m also trying to get more than 10 posts at a time. I just want to know where you are writing this code; is this in Homepage.js and then you’re calling .map() over portfolioHand? I’m new to Frontity and I’m still confused on where, when, and how I can update/modify the request.
Hi @jdkolassa, you need to create an handler, in my case “portfolioHand”, you fetch more than 10 posts by the handler query, and after in your loop page call the handler function to fetch items (named “portfolioEl” in my case you see in homepage.js).
In handler function specify the path where you want to execute your fetch (/portfolio/ in my case).
You need to import your handler in the index.js config file into sources.
Unfortunately i can reply by smartphone now and i’m not able to copy and paste some code…
I hope it’s helpfull