Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

querying within a post hierarchy

  • 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.

  • 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.

  • I wasn’t, but that would be a much better way to approach this!

  • 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.?

  • 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 > Lyon

    Can 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!

  • OK, thanks

  • No Problem 🙂

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.