1

I have two views set up: one that displays the image field, title, and description for each taxonomy terms in a vocabulary, and one that displays a grid of photos/nodes that are tagged with a taxonomy term. What I want is to always display the parent term image/description in the first View so that users can drill down to the children terms, and then ultimately click into the second view of photos/nodes.

For instance, the first View is made up of taxonomy terms associated with the taxonomy vocabulary "Gallery". Under gallery, I have the terms "Parties" and "Games". Parties has no children terms, but "Games" has "Sports" and "Other Games" as children terms.

I would like the Gallery View page content to be displayed this way:

[parties] [games]

Clicking "Parties" would bring you to a view page (the second View) that shows all of the photos/nodes tagged with that term. Clicking "Games" would take you to a View similar to the first View that shows the taxonomy fields for the child category, like so:

[sports] [other games]

Clicking on "Sports" or "Other Games" would take you to a view page that shows all of the photos/nodes tagged with that term, like the "Parties" page operates in the example above.

Make sense? Hoping someone here can point me in the right direction.

Thanks!

1

What you would probably want to do is create a view of the taxonomy terms that lists Parties, Sports, etc. On the fields to display, re-write the output to a link to categories/%1, which will take the term being listed as an argument, and make sure to un-check link to taxonomy page. For this view you should make the link something like "categories". Then, in the second view (or maybe just another page in the same view), make the link something like "categories/%" The % wildcard will take in the value of the taxonomy term form the page before. So when you click the link from the first page it will link you to the second view, where you can make a contextual filter that takes the taxonomy term given via the URL from the one clicked on the first page and have it list the terms based on that with a relationship.

enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

  • Sorry if this seems long winded. If you need screenshots of something similar I can provide those as well. – CR47 Apr 25 '13 at 2:19
  • that would be great if you could provide screenshots. Thanks! – hockey2112 Apr 25 '13 at 4:09
  • @hockey2112 Sorry it's taken so long for me to get back to you. Last semester, finals, etc. etc....anyway I've tried uploading the pictures to imgur but that didn't work so I will add them to here directly. – CR47 May 1 '13 at 2:46
1

It seems the main task is that you want to display two views per taxonomy term: Child terms, and associated content. There might be terms where you only have child terms but no associated content, and other terms where you have only associated content but no child terms. And there might be terms where you have both.

I usually do this with Display suite + Dynamic fields, or with views_content_ds. This gives you full control where the two views appear in your layout, and also allows to display additional fields.

  1. Create a "Content pane" views display "Child terms", with a contextual filter "parent term" and argument input set to "Taxonomy term id".

  2. Create a "Content pane" views display "Tagged nodes", with a contextual filter "referenced taxonomy term" based on the taxonomy term reference field, and argument input set to "Taxonomy term id".

  3. Configure the taxonomy term page display to use Display Suite (by choosing a display suite layout).

  4. Two options:

    1. Create two "dynamic fields", and position them in the layout. Click the cog-wheel to let one of them display the child terms, and the other display the tagged nodes. (You will need to have ds_extras enabled, and enable some stuff under the ds_extras options, I think). OR

    2. Install views_content_ds, and the two Views displays will be available as fields automatically in the "Manage display" of the taxonomy term.

  5. Optionally, you can display other fields from the taxonomy term entity along with the two views displays.

  6. Not sure you need that, but Taxonomy display allows to configure how associated content is being displayed. I usually only use this to disable the core behavior, but then use the views_content_ds fields to actually display the associated content.

  7. Optionally, you could use Entity aspect to have different view modes for different types of taxonomy terms. E.g. on one site I am using this to distinguish between "leaf terms" and "root terms".

A lot of this stuff could be done with Panels / Page manager, instead of Display suite + Entity aspect. I am obviously biased here, and like the latter more :)

Some of these steps could use more detailed instructions, but I think this would be too much for this answer.

0

Your idea wasn't completely intelligible, so I may be off the mark with this advice, in which case excuse me. But it sounds as if you want a taxonomy term view and separate content view displayed together, contextually filtered by the term id. If that's correct, it's very easy.

  1. Create the content view, and set up your fields, filters and sort order.

  2. Add a contextual filter, choosing content has taxonomy term id, choose your preferred behaviour when the filter value is not in the url (eg hide content) and specify validation criteria.

  3. Note that if for any reason you want to use the term name rather than tid, you'll need to add a relationship, picking content: terms on node - and choose "taxonomy term name" as your contextual filter (as opposed to tid). If your term name includes spaces, ensure you check "Transform spaces to dashes in URL" them from the More section. This is a much trickier approach than simply using tid, but I include it here just in case!

  4. Set a path for your view, including a % wherever the tid will appear (in your case probably taxonomy/term/%).

  5. For the taxonomy term view, begin by adding a contextual filter for taxonomy term tid before configuring its no results behaviour and validation.

  6. Add a relationship for taxonomy term parent term.

  7. Add your desired fields, configuring each to use the parent term relationship and save.

  8. No need to worry about creating a page display for this. Leaving it as Master or using an attachment display is fine.

  9. Return to the content view. In Header, add Global View Area and choose the taxonomy term view you've just created, making sure you check "inherit contextual filters". In doing this you'll embed your parent term and its info in it's child terms' content displays.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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