| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | // hook into the init action and call create_semester_taxonomies when it fires |
|---|
| 5 | add_action( 'init', 'create_semester_taxonomies', 0 ); |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | // create two taxonomies, terms and writers for the post type "semester" |
|---|
| 9 | function create_semester_taxonomies() { |
|---|
| 10 | // Add new taxonomy, make it hierarchical (like categories) |
|---|
| 11 | $labels = array( |
|---|
| 12 | 'name' => _x( 'Terms', 'taxonomy general name' ), |
|---|
| 13 | 'singular_name' => _x( 'Term', 'taxonomy singular name' ), |
|---|
| 14 | 'search_items' => __( 'Search Terms' ), |
|---|
| 15 | 'all_items' => __( 'All Terms' ), |
|---|
| 16 | 'parent_item' => __( 'Parent Term' ), |
|---|
| 17 | 'parent_item_colon' => __( 'Parent Term:' ), |
|---|
| 18 | 'edit_item' => __( 'Edit Term' ), |
|---|
| 19 | 'update_item' => __( 'Update Term' ), |
|---|
| 20 | 'add_new_item' => __( 'Add New Term' ), |
|---|
| 21 | 'new_item_name' => __( 'New Term Name' ), |
|---|
| 22 | 'menu_name' => __( 'Term' ), |
|---|
| 23 | ); |
|---|
| 24 | |
|---|
| 25 | $args = array( |
|---|
| 26 | 'hierarchical' => true, |
|---|
| 27 | 'labels' => $labels, |
|---|
| 28 | 'show_ui' => true, |
|---|
| 29 | 'show_admin_column' => true, |
|---|
| 30 | 'query_var' => true, |
|---|
| 31 | 'rewrite' => array( 'slug' => 'terms' ), |
|---|
| 32 | ); |
|---|
| 33 | |
|---|
| 34 | register_taxonomy( 'terms', array( 'post' ), $args ); |
|---|
| 35 | |
|---|
| 36 | } |
|---|