how to add unique ID for each term ?

exemple :

transform
<a rel="tag" class="tagadelic level3" href="/category/content/music">music</a>

to

<a rel="tag" class="tagadelic level3 music" href="/category/content/music">music</a>

or

<a rel="tag" id="music" class="tagadelic level3 music" href="/category/content/music">music</a>

in fine, i want to create a vocabulary "by color" index and i need to have classes green, pink, red,...

by advance,
thank you

Comments

bohart’s picture

Priority: Normal » Minor

put this code in template.php of your theme

function phptemplate_tagadelic_weighted($terms) {
  $output = '';
  foreach ($terms as $term) {
    $output .= l($term->name, taxonomy_term_path($term), array('attributes' => array('class' => "tagadelic id-{$term->tid} level{$term->weight}", 'rel' => 'tag'))) ." \n";
  }
  return $output;
}

and you get unique class for each term link

plsk’s picture

thank you very much

another question: how to apply this to faceted search ?

plsk’s picture

Bèr Kessels’s picture

Status: Active » Closed (works as designed)