Link Taxonomy Terms to Custom Views in Drupal


Link Taxonomy Terms to Custom Views in Drupal

By default, views of type Term link to category pages (taxonomy/term/[tid]). I find that category pages are more useful as custom views where you can control fields. You can effectively replace the default category pages with a customized view by following this views recipe. And no programming is needed.
First create the categories block
<li>Create a new view of type "Term"</li>
<li>Add a block display</li>
<li>Set row style to fields</li>
<li>Add Taxonomy: Term ID as a field (this must be first). Be sure to set "Exclude from display". This information will be used to as an argument in our other view.</li>
<li>Add Taxonomy: Term as a field. Check "Output this field as a link" and set the link path to your-other-view-path/[tid] You will only have the token for Term ID available if the Term ID field is listed above the current field.</li>
<li>Create a new view of type "Node"</li>
<li>Add a page display</li>
<li>Set the path to the same path used in step 5. ( your-other-view-path )
<li>Add a Taxonomy: Term ID argument</li>
<li>Customize the rest of the view to your liking</li>

Now, term listings will link to your custom view instead of the default category listing page. Because your custom view takes an argument, you will restrict the view to listing the very same nodes that the default category listing will show. However, you now have the power of views to customize the display.

<h2>Related Drupal Reading</h2>
<li><a href="internal:node/1697">Drupal Website Cutover Checklist</a></li>
<li><a href="internal:node/1889">jQuery Full-Screen Video Fix For Drupal</a></li>
<li><a href="internal:node/8">Drupal Node Module Skeleton</a></li>

Related Posts

Custom Dynamic Pages with Drupal Arguments and Views

Chris Sloan
Read more

Drupal Tutorial: Use Views to Create an Alphabetical List of Taxonomy Terms

Kristin Brinner
Read more

Defining Custom Field Types in Drupal

Ian Whitcomb
Read more

Creating Custom Fields In Drupal Using Display Suite

Kyle Taylor
Read more

Collapsing Folders with Taxonomy and Views_tree

Randall Knutson
Read more

Fighting Field Labels with Display Suite Extras

Kyle Taylor
Read more