Archived topic
Show Category, subcategory and linked posts
1 reply · Started by Fernando on August 1, 2021
I can't find a way or an option to create a shorcode that queries the current category and displays its child categories, with the list of posts in each child category.
For example. If I'm in a cat website, in the first screen I would show me:
*category--> cats
--> Persian cat (Subcategory)
-------> Persian cat care (Link post)
-------> Why do Persian cats sleep a lot? (Link post)
--> European cat (Subcategory)
-------> Origin of the European cat (Link publication)
This would be a representation in the main archive category
If I decide to go into people breeds, the subcategory archive should only show me
--> Persian cat (Subcategory)
---> Persian cat care (Link post)
---> Why do Persian cats sleep a lot? (Link post)
Is this possible with a shorcode for custom post types?
Hi there,
GeneratePress itself doesn't have an option to do something like this.
Building something like this would require some custom development, perhaps using the wp_list_categories() function: https://developer.wordpress.org/reference/functions/wp_list_categories/
It may be worth asking over on https://wordpress.stackexchange.com/ to see if someone has a solution on hand.