Skip to content

Instantly share code, notes, and snippets.

@johnbhartley
Created December 11, 2012 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save johnbhartley/4255964 to your computer and use it in GitHub Desktop.
Save johnbhartley/4255964 to your computer and use it in GitHub Desktop.
Custom Tax
<?php
$query = new WP_Query(array('post_type' => 'custom-post-type'));
while ($query->have_posts()) : $query->the_post();
$terms = get_the_terms( $post->id, 'custom-taxonomy' ); // registered custom taxonomy in custom post type
$term_description = array();
$term_name = array();
if($terms)
{
foreach( $terms as $term ) {
$term_slug[] = $term->slug; // save the slugs in an array
$term_name[] = $term->name; // save the slugs in an array
}
} //end count terms conditional.
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment