Skip to content

Instantly share code, notes, and snippets.

@krishna19
Created November 22, 2015 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krishna19/8c2226bcc3e2b822695e to your computer and use it in GitHub Desktop.
Save krishna19/8c2226bcc3e2b822695e to your computer and use it in GitHub Desktop.
list all tags and show current
<ul class="accordian-content">
<?php
$tags = get_tags();
if ($tags) {
foreach ($tags as $tag) {
$isCurrent = ((int) $tag->term_id === get_queried_object_id()) ? 'class="current"' : '';
echo '<li' . $isCurrent .'><a href="' . get_tag_link( $tag->term_id ) . '">' . $tag->name.'</a> </li>';
}
}
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment