How to show all nodes tagged with children terms with Views 2 for Drupal 6

The Views module for Drupal 6 (also known as Views 2) ships with several default views which allow you to override certain Drupal core list pages. One of the most useful of these views is the view provided for taxonomy term list. Just recently I decided to set up views to override my taxonomy pages so that they would show children terms, but when I jumped into the Views 2 interface and tried to actually do it I was left a little perplexed; if you are reading this page you probably were too. Some aspects of Views 2 are very poorly documented on the web, and when I did a Google search for “drupal views how to show children terms taxonomy page” the documentation for my own Advanced Taxonomy Blocks module was the 4th on the list, and the other entries were completely off topic. I finally figured it out by reading through the issue queue of the Views module and I am posting this here to make it easier for others.

The first step of course is to install views if you haven’t already; once you’ve done that go to Site Building > Views and look for the view named “Node view: taxonomy_term (default)”. Enable that view then click the edit button to go to the configuration page.

sitesdefaultfilesuploadsviews-2-display-options-jpg-00001532-5887032

If you haven’t already edited this view on the left side of the page you will see 4 display types: Defaults, Page, Core feed, and Views 1 feed. Click on the link labled “Page”. This is an important step that is easy to overlook, and the following will not work otherwise.

views-taxonomy-term-id-with-depth-5260345

Next, in the center of the page under “Arguments” click the link that says “Taxonomy: Term ID (with depth)”. Clicking this loads a user interface through ajax, so you need to scroll down to see the new elements. Near the bottom of the page is a small dropdown that says “Depth”. This is the element that you need to change. Set it to 10. What this does is tell the view to look for children terms that are as many as ten levels below the parent term. If you are sure that you won’t have any terms any deeper than 5 levels then by all means set it to 5; I use 10 just in case.

views-depth-7691336

You might also want to select the option that says “Set the breadcrumb for the term parents” as this will improve your user experience.

Click “Update default display” then save your view and you’re done. Your taxonomy pages will now be automatically overridden to show nodes that have been tagged with both the term itself or any of its children terms.