Skip to content

Instantly share code, notes, and snippets.

@zakhardage
Last active December 17, 2015 21:09
Show Gist options
  • Save zakhardage/5672832 to your computer and use it in GitHub Desktop.
Save zakhardage/5672832 to your computer and use it in GitHub Desktop.
Displays blog tags a color links. Used here: http://www.lmaeboutique.com/blog/
a {display:block; float:left; color:#898989; text-decoration:none; padding:0 8px 8px 8px; width:90px; text-transform:capitalize; border-right:thin solid #c2b59b; white-space: nowrap; overflow: hidden; -o-text-overflow: ellipsis; -ms-text-overflow: ellipsis; text-overflow: ellipsis;}
a.one {padding:0 8px 8px 0;}
a.three {border-right:none;}
a span {display:inline-block; height:15px; width:15px; border-radius:7.5px; position:relative; top:3px; margin:0 5px 0 0;}
<?php
$tags = get_tags();
$count = 1;
foreach ( $tags as $tag ) {
$tag_link = get_tag_link( $tag->term_id );
if($count==1) {$html .= "<a class='one' href='{$tag_link}'><span style='background:{$tag->slug}'></span>";}
if($count==2) {$html .= "<a class='two' href='{$tag_link}'><span style='background:{$tag->slug}'></span>";}
if($count==3) {$html .= "<a class='three' href='{$tag_link}'><span style='background:{$tag->slug}'></span>";}
$html .= "{$tag->name}</a>";
$count++;
if($count == 4) {$count=1;}
}
echo $html;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment