Taxonomy terms in page.tpl.php

Category
drupal, taxonomy, themes
Date Created
8th Jan 2010
Last Updated
9th Jul 2010

Taxonomy terms in page.tpl.php

Question

How to make taxonomy terms availble to template.tpl.php using template.php

Answer


function YourThemeName_preprocess_page(&$variables) {
  foreach($variables['node']->taxonomy AS $tax_term) {
    $variables['wowzers'] .= ", $tax_term->name";
  }
  $variables['wowzers'] = substr($variables['wowzers'],1);
}

After entering this in your template.php file the variable $wowzers will be availble for use within your page.tpl.php file.

Please note you can only use one preprocess function per template.tpl.php file.

Related terms