The team is now working on the WordPress Interactivity API. This unblocks the same UX Frontity framework enabled but directly in WordPress Core, fully compatible with the new Site Editor.
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.
I hope that helps.
1 Like
matteo.lcd3
Hi @ni.bonev, thankyou very much! I resolve with an handlers:
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.
matteo.lcd6
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
jdkolassa7
Ah, so “portfolioEl” in your new code = “portfolioHand.items”?
That makes sense, thank you!
matteo.lcd8
@jdkolassa yes, you map posts from
const portfolioEl = state.source.get(/portfolio/).items