Skip to content

Instantly share code, notes, and snippets.

@marcialca
Created May 10, 2013 05:10
Show Gist options
  • Save marcialca/5552518 to your computer and use it in GitHub Desktop.
Save marcialca/5552518 to your computer and use it in GitHub Desktop.
Create and Show Taxonomies on Wordpress
/* show the taxonomies per post */
<?php echo get_the_term_list($post->ID, 'people', 'People: ', ', ', ''); ?>
<?php query_posts(array('people' => 'will-smith', 'showposts' => 10)); ?>
function create_my_taxonomies() {
register_taxonomy('actors', 'post', array(
'hierarchical' => false, 'label' => 'Actors',
'query_var' => true, 'rewrite' => true));
register_taxonomy('producers', 'post', array(
'hierarchical' => false, 'label' => 'Producers',
'query_var' => true, 'rewrite' => true));
}
add_action('init', 'create_my_taxonomies', 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment