Created
February 29, 2016 07:10
-
-
Save amberhinds/a2577d60826b6e73edf1 to your computer and use it in GitHub Desktop.
Register a Taxonomy
This file contains 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 // Don't include this more than once in your file | |
/** | |
* Create taxonomy for testimonials CPT. | |
* | |
* Registers a hierarchical (like categories) taxonomy for the testimonials custom post type | |
* | |
* @see register_taxonomy | |
*/ | |
add_action( 'init', 'fcwp_testimonials_tax' ); | |
function fcwp_testimonials_tax() { | |
$labels = array( | |
'name' => _x( 'Testimonial Categories', 'taxonomy general name' ), | |
'singular_name' => _x( 'Testimonial Category', 'taxonomy singular name' ), | |
'search_items' => __( 'Search Testimonial Categories' ), | |
'all_items' => __( 'All Testimonial Categories' ), | |
'parent_item' => __( 'Parent Testimonial Category' ), | |
'parent_item_colon' => __( 'Parent Testimonial Category:' ), | |
'edit_item' => __( 'Edit Testimonial Category' ), | |
'update_item' => __( 'Update Testimonial Category' ), | |
'add_new_item' => __( 'Add New Testimonial Category' ), | |
'new_item_name' => __( 'New Testimonial Category' ), | |
'menu_name' => __( 'Testimonial Categories' ), | |
); | |
$args = array( | |
'hierarchical' => true, | |
'labels' => $labels, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'testimonial-categories' ), | |
); | |
register_taxonomy( 'testimonials-tax', 'testimonial', $args ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment