Created
May 22, 2015 20:36
-
-
Save DenisLeblanc/61e7bfe2e584256c125e to your computer and use it in GitHub Desktop.
Custom Post Type and 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 | |
// REGISTER CUSTOM POST TYPE FOR SERVICES | |
function team_custom_init() { | |
$labels = array( | |
'name' => _x('Team', 'post type general name'), | |
'singular_name' => _x('Member', 'post type singular name'), | |
'add_new' => _x('Add New', 'member'), | |
'add_new_item' => __('Add New Member'), | |
'edit_item' => __('Edit Member'), | |
'new_item' => __('New Member'), | |
'all_items' => __('All Team Members'), | |
'view_item' => __('View Member'), | |
'search_items' => __('Search Team'), | |
'not_found' => __('No members found'), | |
'not_found_in_trash'=> __('No members found in Trash'), | |
'parent_item_colon' => '', | |
'menu_name' => __('Team') | |
); | |
$args = array( | |
'labels' => $labels, | |
'public' => true, | |
'publicly_queryable'=> true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'query_var' => true, | |
'rewrite' => array( | |
'slug' => 'team', | |
'with_front' => 'false' | |
), | |
'capability_type' => 'post', | |
'has_archive' => 'team', | |
'hierarchical' => false, | |
'menu_position' => null, | |
'menu_icon' => 'dashicons-businessman', | |
'supports' => array( | |
'title', | |
'editor', | |
'thumbnail' | |
) | |
); | |
register_post_type('team', $args); | |
} | |
add_action( 'init', 'team_custom_init' ); | |
// CREATE TEAM TAXONOMY | |
function team_taxonomy() { | |
$labels = array( | |
'name' => 'Practices', | |
'singular_name' => 'Practice', | |
'search_items' => 'Search Practices', | |
'all_items' => 'All Practices', | |
'parent_item' => 'Parent Practice', | |
'parent_item_colon' => 'Parent Practice:', | |
'edit_item' => 'Edit Practice', | |
'update_item' => 'Update Practice', | |
'add_new_item' => 'Add New Practice', | |
'new_item_name' => 'New Practice Name', | |
'menu_name' => 'Practice', | |
); | |
$args = array( | |
'hierarchical' => true, | |
'labels' => $labels, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( | |
'slug' => 'team-categories' | |
), | |
); | |
register_taxonomy('team-taxonomy', 'team', $args); | |
$labels = array( | |
'name' => 'Clinics', | |
'singular_name' => 'Clinic', | |
'search_items' => 'Search Clinics', | |
'all_items' => 'All Clinics', | |
'parent_item' => 'Parent Clinic', | |
'parent_item_colon' => 'Parent Clinic:', | |
'edit_item' => 'Edit Clinic', | |
'update_item' => 'Update Clinic', | |
'add_new_item' => 'Add New Clinic', | |
'new_item_name' => 'New Clinic Name', | |
'menu_name' => 'Clinic', | |
); | |
$args = array( | |
'hierarchical' => true, | |
'labels' => $labels, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => array( | |
'slug' => 'associated-clinic' | |
), | |
); | |
register_taxonomy('clinic-taxonomy', 'team', $args); | |
} | |
add_action('init', 'team_taxonomy', 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment