colbyfayock / next-wordpress-starter

📝 Bring WordPress to the static world with Next.js
https://next-wordpress-starter.spacejelly.dev
MIT License
1.19k stars 292 forks source link

Category Archives page only show 10 posts and no Pagination #370

Open huynhtan1808 opened 2 years ago

huynhtan1808 commented 2 years ago

Hi, I recently found out that the Categories Archives page only shows 10 posts and does not have pagination. Can you check it?

Bonus: How Can I make Featured images show in Related Posts?

colbyfayock commented 2 years ago

hey will look into the 10 posts issue, thanks. for the UI check out my comment here:

https://github.com/colbyfayock/next-wordpress-starter/issues/358

huynhtan1808 commented 2 years ago

@colbyfayock Hello, Can you please check the 10 posts in the Category page?

handipriyono commented 1 year ago

Hi, @colbyfayock , any update on this? just show 10 post only on category page? and no pagination

colbyfayock commented 1 year ago

pagination as you've noticed isnt implemented on categories or i dont think any archive-like page

i likely won't be doing major work on the starter "as is" as i've started slowly working on migrating it over to the App Router

https://github.com/colbyfayock/next-wordpress-starter/pull/477

if you want to see how it's being done in the current project for the homepage, you can check out this function for getting paginated posts:

https://github.com/colbyfayock/next-wordpress-starter/blob/main/src/lib/posts.js#L388

which if repurposed for categories or anything else, you should be able to plug in the result into the pagination prop of the archive template:

https://github.com/colbyfayock/next-wordpress-starter/blob/main/src/templates/archive.js#L26 https://github.com/colbyfayock/next-wordpress-starter/blob/main/src/pages/categories/%5Bslug%5D.js#L18

would be happy to take a PR for this, as likely the functionality would be needed for the migrated version whenever i get to that part of it