Skip to content

Instantly share code, notes, and snippets.

@zakhardage
Created November 1, 2013 07:20
Show Gist options
  • Select an option

  • Save zakhardage/7261926 to your computer and use it in GitHub Desktop.

Select an option

Save zakhardage/7261926 to your computer and use it in GitHub Desktop.
Colored links from post tags. Example: http://www.lmaeboutique.com/blog/
<div class="widget">
<h3>Style by Color</h3>
<?php
$tags = get_tags();
foreach ($tags as $tag) {
$tag_link = get_tag_link( $tag->term_id );
$background = ' ' . $tag->slug;
$html .= "<a href='{$tag_link}'><span style='background:{$tag->slug};'></span>";
$html .= "{$tag->name}</a>";
}
echo $html;
?>
</div> <!-- end .widget -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment