Skip to content

Instantly share code, notes, and snippets.

@davemac
Created October 18, 2011 04:25
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 davemac/1294606 to your computer and use it in GitHub Desktop.
Save davemac/1294606 to your computer and use it in GitHub Desktop.
WordPress return custom taxonomy terms with category description
<ul>
<?php
$args=array(
'taxonomy' => 'productcat',
'orderby' => 'name',
'order' => 'ASC'
);
$categories=get_categories($args);
foreach($categories as $category) {
echo '<li><div class="portfoliobg"><h3><a href="' . get_term_link( $category->slug, $args['taxonomy'] ) . '" ' . '>' . $category->name.'</a> </h3> ';
echo '<a class="tax-link" href="' . get_term_link( $category->slug, $args['taxonomy'] ) . '">Products: '. $category->count . '</a>';
echo '<img src="/wp-content/themes/minibuzz3/images/' . $category->slug . '.jpg" alt="' . $category->slug . '" />';
echo '</div>';
echo '<p>'. $category->description . '</p></li>';
}
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment