taxonomy-term.tpl.php

Default theme implementation to display a term.

Available variables:

  • $content: An array of items for the content of the term (fields and description). Use render($content) to print them all, or print a subset such as render($content['field_example']). Use hide($content['field_example']) to temporarily suppress the printing of a given element.
  • $url: Direct url of the current term.
  • $label: Name of the current term.
  • $attributes: An instance of Attributes class that can be manipulated as an array and printed as a string. It includes the 'class' information, which includes:

    • taxonomy-term: The current template type, i.e., "theming hook".
    • vocabulary-[vocabulary-name]: The vocabulary to which the term belongs to. For example, if the term is a "Tag" it would result in "vocabulary-tag".

Other variables:

  • $term: Full term object. Contains data that may not be safe.
  • $view_mode: View mode, e.g. 'full', 'teaser'...
  • $page: Flag for the full page state.
  • $zebra: Outputs either "even" or "odd". Useful for zebra striping in teaser listings.
  • $id: Position of the term. Increments each time it's output.
  • $is_front: Flags true when presented in the front page.
  • $logged_in: Flags true when the current user is a logged-in member.
  • $is_admin: Flags true when the current user is an administrator.

See also

template_preprocess()

template_preprocess_taxonomy_term()

template_process()

File

drupal/core/modules/taxonomy/templates/taxonomy-term.tpl.php
View source
<?php

/**
 * @file
 * Default theme implementation to display a term.
 *
 * Available variables:
 * - $content: An array of items for the content of the term (fields and
 *   description). Use render($content) to print them all, or print a subset
 *   such as render($content['field_example']). Use
 *   hide($content['field_example']) to temporarily suppress the printing of a
 *   given element.
 * - $url: Direct url of the current term.
 * - $label: Name of the current term.
 * - $attributes: An instance of Attributes class that can be manipulated as an
 *    array and printed as a string.
 *    It includes the 'class' information, which includes:
 *   - taxonomy-term: The current template type, i.e., "theming hook".
 *   - vocabulary-[vocabulary-name]: The vocabulary to which the term belongs to.
 *     For example, if the term is a "Tag" it would result in "vocabulary-tag".
 *
 * Other variables:
 * - $term: Full term object. Contains data that may not be safe.
 * - $view_mode: View mode, e.g. 'full', 'teaser'...
 * - $page: Flag for the full page state.
 * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in
 *   teaser listings.
 * - $id: Position of the term. Increments each time it's output.
 * - $is_front: Flags true when presented in the front page.
 * - $logged_in: Flags true when the current user is a logged-in member.
 * - $is_admin: Flags true when the current user is an administrator.
 *
 * @see template_preprocess()
 * @see template_preprocess_taxonomy_term()
 * @see template_process()
 *
 * @ingroup themeable
 */
?>
<div id="taxonomy-term-<?php

print $term->tid;
?>"<?php

print $attributes;
?>>

  <?php

if (!$page) {
  ?>
    <h2><a href="<?php

  print $url;
  ?>"><?php

  print $label;
  ?></a></h2>
  <?php

}
?>

  <div class="content">
    <?php

print render($content);
?>
  </div>

</div>

Related topics