Created
May 10, 2013 05:10
-
-
Save marcialca/5552518 to your computer and use it in GitHub Desktop.
Create and Show Taxonomies on Wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* show the taxonomies per post */ | |
| <?php echo get_the_term_list($post->ID, 'people', 'People: ', ', ', ''); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php query_posts(array('people' => 'will-smith', 'showposts' => 10)); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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