Custom taxonomy as HTML class


Custom taxonomy as HTML class



I have a custom taxonomy that needs a different colour applied to each term inside. I figured I could grab the slug of the taxonomy and put it in a class. Unfortunately I've been defeated with every try. I've tried a few things with get terms to no avail.

Sample of what I'd like

<div class="<?php echo $myCustomClass; ?>">the custom taxonomy</div> 

Wordpress Email subscribtion?

1:

tinymce wordpress copy and paste losing http:// prefix
First you would need to receive the custom taxomomy and loop through every term applying the slug of the term as the class.. More than 1 widget in wordpress
<?php   // receive  the tags from your custom taxonomy, in this case it's 'skills'   $tags = receive _terms('skills');    // print out the start of the list, putting an ID on it to make styling it easier   echo '<ul id="taxonomy-list-skills">';   // loop through each tag as a list item   foreach($tags as $tag)   {      echo '<li class="'.$tag->slug.'">'.$tag->name.'</li>';   }   // close the list   echo  '</ul>'; ?>  
add a page to sidebar

65 out of 100 based on 40 user ratings 635 reviews

@