Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /************************************************************************************
- * Here's an example of registering a "people_cat" taxonomy:
- * To register a taxonomy, you use the register_taxonomy() function.
- * The "people" taxonomy is defined. It's defined to work for posts.
- * A rewrite slug is defined to make the url into '/person/' instead of '/people/'.
- *The capabilities line is optional. Without it, WordPress will default capabilities to the same users as posts. As shown above, this will allow any user with the custom "edit_guides" capability to assign the taxonomy to a post and any user with the custom "publish_guides" capability to create new taxonomy items.
- *************************************************************************************/
- function themename_custom_taxonomy() {
- // create a new taxonomy
- register_taxonomy(
- 'portfolio_cat', // must not contain capital letters or spaces
- 'post', // (post/custom post) type name
- array(
- 'hierarchical' => true,
- 'label' => 'Portfolio Categories', //Display Name
- 'query_var' => true,
- 'rewrite' => array('slug' => 'portfolio-category')
- )
- );
- }
- add_action( 'init', 'themename_custom_taxonomy' );
- /************************************************************************************
- Usage of Custom Taxonomy
- *************************************************************************************/
- 'portfolio_cat' => 'Feature'; //
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement