Skip to content

Instantly share code, notes, and snippets.

@bencooling
Created December 18, 2012 00:11
Show Gist options
  • Save bencooling/4323655 to your computer and use it in GitHub Desktop.
Save bencooling/4323655 to your computer and use it in GitHub Desktop.
Wordpress Taxonomy related snippets
/* List child categories
---------------------------------------------------------------------------------------------------------*/
<?php
$args = array('parent' => get_query_var('cat'), 'hide_empty' => false);
$categories=get_categories($args);
foreach($categories as $category) {
echo '<p>Category: <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> ';
echo '<p> Description:'. $category->description . '</p>';
echo '<p> Post Count: '. $category->count . '</p>'; }
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment