-
mkuhnell
I currently have my photo galleries as a custom post types. They are in hierarchical categories like this:
Europe gallery> France Gallery> lots of individual galleries which are in a category named “France”I would like to have the “France gallery” show all of the posts in that category. How do I set up this query?
Thanks!
-
Hi there,
You should be able to choose the post type and add a taxonomy parameter > category > France.
-
mkuhnell
Sorry, I should have explained that I am doing this in an element to be displayed on all category pages, do it needs to be dynamic.
-
Are you building a loop template?
If so, you do not need to add any parameters, just toggle the inherit query from template option:https://learn.generatepress.com/blocks/block/query/#inherit-query-from-template
When this option is toggled, the query block will show the default posts on the category archive.
-
mkuhnell
I wasn’t, but that would be a much better way to approach this!
-
mkuhnell
Can I use the inherited query but NOT include child terms. For example, to have the “Europe” archive show a grid of “France”, “Germany”, etc., instead of all the posts within France, Germany, etc.?
-
mkuhnell
I suppose that what I want is a query that lists the first-child categories of the current category archive and links to those category archive pages. Hopefully you can understand. I’m not sure exactly how to describe this other than with the example.
Taxonomy structure:
Europe > France > LyonCan I have the Europe taxonomy archive show a link to the France taxonomy archive?
Or am I misunderstanding this completely?
-
Can I use the inherited query but NOT include child terms. For example, to have the “Europe” archive show a grid of “France”, “Germany”, etc., instead of all the posts within France, Germany, etc.?
No, it’s not possible, as this is not how WP organize its archives.
I suppose that what I want is a query that lists the first-child categories of the current category archive and links to those category archive pages.
It will require custom coding, unfortunately!
-
mkuhnell
OK, thanks
-
No Problem 🙂
- You must be logged in to reply to this topic.