3

How would I go about changing a custom taxonomy view / template without using a module?

i.e. I have a taxonomy named 'tutorials' which has three posts.

How would I modify the HTML output for 'tutorials?

From what I've heard, you can create a file named 'taxonomy--name.tpl.php' to override the default taxonomy template?

Thanks!

2

As described in Drupal 7 Theme Hook Suggestions, the template files that Drupal looks for a taxonomy term page are the following:

  • taxonomy-term--[tid].tpl.php
  • taxonomy-term--[vocabulary-machine-name].tpl.php
  • taxonomy-term.tpl.php

Replace [tid] with the taxonomy term ID, and [vocabulary-machine-name] with the machine name set for the vocabulary. Supposing that the machine name is programming_languages, then the template filename that Drupal looks is taxonomy-term--programming-languages.tpl.php. (The underscores are replaced with hyphens.)

The first file that is found is the one that Drupal uses.

0

Basically, if you don't want to use any module, but are fine to carve in your PHP templates, then this taxonomy.module API is what you need. We could probably come up with more detailed help if you described your goal more precisely.

0

You can rewrite output in Views, and change Style (the HTML containers and classes) for each.

Did you mean without create a custom module? If so, there are several contrib taxonomy modules out there:

Taxonomy Formatter -- lets you add HTML wrappers around element and container Taxonomy Page Display -- create custom taxonomy page for each term (or certain terms) Display Suite - let you customize dang near any node or form

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.