How to group post by subcategories in archive pages build with Gutenberg
-
Hi everyone,
This topic is linked to another post I made a few months ago (link here) : back then, I was trying to get WP_Query() to return posts from a subcategory to build a category archive page that would group all posts by subcategory. Basically like this :
Category 1
Subcategory 1A
- Post 1
- Post 2
Subcategory 1B
- Post 3
- Post 4
Category 2 :
Subcategory 2A
- Post 6
- Post 7
Subcategory 2B
- Post 8
- etc..
My code ended up working – the issue was caused by another plugin. I was working on an old website that still uses the classic editor.
Now, I am trying to see If I can get a similar result with Gutenberg. I guess I could build a block for this, but I was wondering if there is another, more simple, way to do so ? Is there a way to create a query look variation that would allow me to apply an order by subcategory condition, and to display the subcategory names ?
I just want to know what would be the best way to proceed for this type of development as I am still not that familiar with the best practices when building a site with Gutenberg.
Thank in advance for your responses !
- You must be logged in to reply to this topic.