admin管理员组

文章数量:1125064

What I have:

  • I'm running a website (on newest WP 6.4.3) that has three distinct categories, and blog posts for each category.
  • Each post specifies this category, and I have hundreds of posts total.
  • I have a landing page for each category which uses the standard block "latest posts" to show the 5 newest posts in that category, followed by a link to an "Archive" page with ALL the posts in that category.

Problem:

  • My current archive page also uses the standard block "latest posts" which is set to its maximum value of 100 posts. This causes older posts to be hidden.
  • I tried to use the standard block "Archive", but it cannot filter by category, so it shows posts from all categories.
  • On a whim, I tried asking ChatGPT for help, and it offered custom code to embed. I hope that a nicer solution exists.

What I want:

  • I want to build a page that shows ALL posts from ONE category.
  • I would have three separate archive pages (one for each category), each one showing only posts from that specific category.
  • It would be fine to be able to specify multiple but not all categories in one such archive block.
  • Ideally, this should include pagination.

What I have:

  • I'm running a website (on newest WP 6.4.3) that has three distinct categories, and blog posts for each category.
  • Each post specifies this category, and I have hundreds of posts total.
  • I have a landing page for each category which uses the standard block "latest posts" to show the 5 newest posts in that category, followed by a link to an "Archive" page with ALL the posts in that category.

Problem:

  • My current archive page also uses the standard block "latest posts" which is set to its maximum value of 100 posts. This causes older posts to be hidden.
  • I tried to use the standard block "Archive", but it cannot filter by category, so it shows posts from all categories.
  • On a whim, I tried asking ChatGPT for help, and it offered custom code to embed. I hope that a nicer solution exists.

What I want:

  • I want to build a page that shows ALL posts from ONE category.
  • I would have three separate archive pages (one for each category), each one showing only posts from that specific category.
  • It would be fine to be able to specify multiple but not all categories in one such archive block.
  • Ideally, this should include pagination.
Share Improve this question asked Feb 2, 2024 at 7:32 Torben Gundtofte-BruunTorben Gundtofte-Bruun 1451 gold badge1 silver badge8 bronze badges 9
  • The Posts List block, which is a variation of the Query Loop block, supports filtering by 1 or more categories, so have you tried the Posts List block, or maybe the Query Loop block? – Sally CJ Commented Feb 2, 2024 at 23:54
  • @SallyCJ thank you - I must confess that I am more of a coder and I am completely confused and overwhelmed by the concept of "blocks", especially when there are blocks inside other blocks. I have now tried several variations with these blocks and I just can't work it out. So much mousing and clicking... isn't there a piece of code I can drop in? – Torben Gundtofte-Bruun Commented Feb 6, 2024 at 21:07
  • "I tried to use the standard block "Archive", but it cannot filter by category" - actually, which block is that? What theme are you using, is it a core theme like Twenty Twenty-Four? And my initial understanding was that you were trying to have custom archive/Posts pages, hence I suggested the Posts List block. – Sally CJ Commented Feb 7, 2024 at 17:25
  • Regarding this - "completely confused and overwhelmed by the concept of "blocks"" - developer.wordpress.org/block-editor/explanations/architecture/… might help

    本文标签: categoriesIs there a standard quotArchivequot block that shows ALL posts from a specified category