Skip to content

Instantly share code, notes, and snippets.

@atsea
Last active August 29, 2015 14:04
Show Gist options
  • Save atsea/d361ff73e8f03e5d90b8 to your computer and use it in GitHub Desktop.
Save atsea/d361ff73e8f03e5d90b8 to your computer and use it in GitHub Desktop.
WordPress: Get the Current Taxonomy of the Post
require_once('functions.php');
if ( is_active_sidebar( 'sidebar-1' ) ){
$terms = get_the_terms( $post->ID, 'software_categories' );
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, 'software_categories' );
echo "<a href='".$term_link."'>" . $term->name . "</a>, ";
}
?>
<div id="sidebar">
<h3>Category</h3>
<ul>
<li><a href="/software-by-category/Antivirus and Security/"><?php echo $category->name; ?></a></li>
</ul>
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div> <!-- end #sidebar -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment