So I'm on D7, Views 3, and I'm overriding the default taxonomy/term code with the provided view in Views 3. I'm trying to set up a contextual filter/argument to display terms based on their content type. For example, I have several content types - "audio", "document" and "article", and I want to be able to have:

/taxonomy/term/14/audio

display only the nodes of type "audio" having tid 14, likewise

/taxonomy/term/14/article

displaying only nodes of type "article".

Of course having no argument:

/taxonomy/term/14

would just display nodes of ALL content types whose tid was 14.

Not sure if I need some special validation code or if this is even possible with Views 3... Am I making any sense? Can anyone point me in the right direction?

Thanks!

Comments

nevets’s picture

Add a contextual filter on "Content: Type"

hawkeye217’s picture

Of course that was my first step to try, but it does not seem to be working, hence my question about if I was needing some sort of validation or if there was just something blatantly obvious that I was missing.

hawkeye217’s picture

Well, maybe I am just being dumb because it's late.

I guess I had the 2nd argument in my view set up as "taxonomy term id with depth modifier", which, when forming a url like:

/taxomony/term/14/1/audio

gets me what I am looking for.

But, I'm not sure I understand why.

In addition, it does not seem to work with pathauto generated aliases - for example with tid 14 being called "subject1", /resources/subject1/audio or /resources/subject1/1/audio does not work. Apparently views just sees things as /taxonomy/term/14 (see http://grasmash.com/comment/4), therefore I am not sure how to add the node type argument after a pathauto generated alias.

Utterly confused...

skizzo’s picture

maybe you have three contextual filters:
Content: Has taxonomy term ID (with depth) = 14
Content: Has taxonomy term ID depth modifier = 1
Content: Type = audio

Do you really need the modifier? if not, just remove it. Then you should be able to enter /taxomony/term/14/audio. I could be wrong, but as I understand it you need the depth modifier only if you want to pick nodes that are tagged with a child term (e.g. hierarchically under term 14) while not being tagged with the father term itself (e.g.: 14). Under those circumstances you would use /taxomony/term/14/1/audio to pick those nodes.

Does that make sense?