Last active
April 29, 2017 11:06
-
-
Save imvarunkmr/c2b9f7901b7c883ca77074f9cba4d62f to your computer and use it in GitHub Desktop.
Registering a custom 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 | |
/** | |
* Add custom taxonomy for project services | |
*/ | |
add_action( 'init', 'services', 0); | |
function services() { | |
$labels = array( | |
'name' => _x( 'Services', 'taxonomy general name', 'textdomain' ), | |
'singular_name' => _x( 'Service', 'taxonomy singular name', 'textdomain' ), | |
'search_items' => __( 'Search Services', 'textdomain' ), | |
'all_items' => __( 'All Services', 'textdomain' ), | |
'parent_item' => __( 'Parent Service', 'textdomain' ), | |
'parent_item_colon' => __( 'Parent Service:', 'textdomain' ), | |
'edit_item' => __( 'Edit Service', 'textdomain' ), | |
'update_item' => __( 'Update Service', 'textdomain' ), | |
'add_new_item' => __( 'Add New Service', 'textdomain' ), | |
'new_item_name' => __( 'New Service Name', 'textdomain' ), | |
'menu_name' => __( 'Service', 'textdomain' ), | |
); | |
$args = array( | |
'hierarchical' => true, | |
'labels' => $labels, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'service' ), | |
); | |
register_taxonomy( 'service', array( 'book' ), $args ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment