Evanss
Evanss

Reputation: 23553

Drupal - On term page show child terms?

On term page, how can I show just the immediate child terms? So if I had this structure:

Colors
-Red
-Green
-Blue
--Blue1
--Blue2

On the Colors term page you would see Red, Green and Blue. On the Blue term page you would see Blue1 and Blue2.

Initially I thought views could do this, and Id also love to be able to use an easy UI, but it doesn't seem to be possible.

Thanks

Upvotes: 1

Views: 4214

Answers (3)

HEDMON
HEDMON

Reputation: 737

You can clone the views 'Taxonomy term' that is 'A view to emulate Drupal core's handling of taxonomy/term.' In contextual filter > Content: has taxonomy term ID (with depth) you can control it. In your case, I guess must have value 1.

contextual filter: Content: Has taxonomy term ID (with depth)

Upvotes: 1

nmc
nmc

Reputation: 8686

The following works for displaying child terms of Blue and other levels below that, but doesn't work for displaying the 1st level Color terms of Red, Green, Blue since they are deemed not to have parents. Perhaps you can create a separate view for this.

enter image description here

Upvotes: 1

red
red

Reputation: 2040

You could write some manual PHP and utilize http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.module/function/taxonomy_get_children/6

Upvotes: 0

Related Questions