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.

Group Posts by Taxonomy (Category) – Long shot.

  • I know this is a long shot and was hoping I would be able to do it with the GB Query Loop but can’t see how.

    What I want to do is list all categories in a page and group the posts of each category under each Category Heading.

    If you think of it in terms of meals; Breakfast, Lunch, Dinner

    BREAKFAST (Category)
    – Full English (post – link to post)
    – Cereal (post – link to post)
    – Fruit (post – link to post)
    – Bacon Butty (post – link to post)

    LUNCH (Category)
    – Salad (post – link to post)
    – Fish and Chips (post – link to post)
    – Lasagne (post – link to post)

    DINNER (Category)
    – Steak (post – link to post)
    – Vegetarian (post – link to post)
    – Soup and Sandwich (post – link to post)
    – Baked Potato (post – link to post)

    Any tips would be appreciated immensely.

    Thanks for reading.

    Martin

  • Hi Martin,

    Do you want to do it on a static page?

    If so, you can create those sections using container and query loop like this.

    - container
      -- static headline (BREAKFAST)
      -- query loop (select category as taxonomy, select the Breakfast category)
    
    - container
      -- static headline (LUNCH)
      -- query loop (select category as taxonomy, select the Lunch category)
    
    - container
      -- static headline (DINNER)
      -- query loop (select category as taxonomy, select the Dinner category)
  • Sorry, I should have said; the Breakfast, Lunch and Dinner example was just an example.

    I want to loop through however many categories exist for the post type. They are not preset like Breakfast, Lunch and Dinner.

  • Do you mean automatically loop through the categories?

    If so, no that’s not possible. you need to manually add the categories.

    Or you need to write custom code for it.

  • Yes, automatically loop through categories.

    I am not surprised it’s not possible with a query loop.

    Thanks for giving it your time.

    Martin

  • You are welcome   🙂

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