2

For each article, I assign a 'sub-category' taxonomy vocabulary term. Then for each 'sub-category' taxonomy term, it links to a 'category' taxonomy vocabulary term.

I have set up a variant of the taxonomy-term template page that passes the category ID as an argument to a view. This view then uses a contextual filter to display all content within all sub-categories for the given category ID.

To illustrate, say you type in sitename.com/taxonomy/term/1922 which is, say, movies. The view will display all content marked with movies' sub categories. So it currently would show this:

/taxonomy/term/1922 (Movies)  
Title         |      Sub-Category |
——————————————————————————————————-  
Star Wars     |            Sci-Fi |  
Star Trek II  |            Sci-Fi |  
Home Alone    |            Comedy |  
Office Space  |            Comedy |  
Thin Red Line |               War |  

What I want is to have, say, 5 pieces of content per sub-category titled by the sub-category. Something like this:

/taxonomy/term/1922 (Movies)

  • Scifi:

    1. Star Wars
    2. Star Trek II
    3. ...
    4. ...
    5. ...
  • Comedy:

    1. OFfice Space
    2. Home ALone
    3. ...
    4. ...
    5. ...

And so forth. So that it would title all sub-categories and show the top x number of nodes per sub-category.

1 Answer 1

1

This isn't a great answer, but after a couple days of trying to do this myself, the best I could figure out was to use Views Field View (I think that Views Grouping Row Limit would probably work too, but it's still in dev).

Create a basic node view that lists off your five movie node titles (along with any other teaser-like content you'd like), set your page to limit to five entries, and set the contextual filter to the movie's taxonomy term.

Then, make a view that shows taxonomies belonging to the vocabulary (movies). Set the contextual filter to "taxonomy term: parent term"), and output the tid (hidden) and term title. That'll make a list of your parent terms, so now add a views_field_view (set it to use your first view for input, and the tid for your argument).

Again, there's got to be a better way than this, as I'm sure it's going to create some real system overhead.

Pleeeease, someone come up with a better answer!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.