Support » Fixing WordPress » How to group by taxonomy term

  • This is the situation:

    I’ve got a custom post type called Disc.
    This Post Type has 1 taxonomy called Genre.
    This taxonomy has 2 terms: Rock and Pop.
    Rock has got a sub-term called Hard Rock.

    I want to show into archive page (or taxonomy page) a list of disc “grouped” by term. I don’t want to put manually the name of taxonomy or term into tpl. It should be dinamic. So, for example:

    ROCK
    ACDC Album blabla
    IRON MAIDEN Album blabla

    POP
    AVRIL LAVIGNE Album blabla
    MILEY CYRUS Album blabla

    And I want to show both the title and the album. The ONLY way i found to do it is using a complex JOIN query. But I don’t want to do this practise anymore. I would like to do this using CORE WordPress functionalities. Is it possible? In Drupal I should have done this using views and “grouped by taxonomy” option. Is there this “equivalent”? Thanks in advance to all

Viewing 2 replies - 1 through 2 (of 2 total)
  • I too am looking for this exact thing. I was able to find a way to list all the terms and related posts but prefer the method of just showing the terms and posts for the given page the user is on.

    if the user decides to add more terms the page would show the new term and related post without having to manually write queries on a per term basis.

    Hello, I’m working with default post default category and a custom taxonomy.

    Try to setup the following loop with your configs:

    http://pastebin.com/AmJp89xU

    :]

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to group by taxonomy term’ is closed to new replies.