Last active
August 29, 2015 14:10
-
-
Save danielpataki/e048ef3e20a91aebd060 to your computer and use it in GitHub Desktop.
Custom Taxonomies
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
add_action( 'init', 'create_athlete_taxonomy' ); | |
function create_athlete_taxonomy() { | |
$labels = array( | |
'name' => 'Athletes', | |
'singular_name' => 'Athlete', | |
'search_items' => 'Search Athletes', | |
'all_items' => 'All Athletes', | |
'edit_item' => 'Edit Athlete', | |
'update_item' => 'Update Athlete', | |
'add_new_item' => 'Add New Athlete', | |
'new_item_name' => 'New Athlete Name', | |
'menu_name' => 'Athlete', | |
'view_item' => 'View Athlete', | |
'popular_items' => 'Popular Athlete', | |
'separate_items_with_commas' => 'Separate athletes with commas', | |
'add_or_remove_items' => 'Add or remove athletes', | |
'choose_from_most_used' => 'Choose from the most used athletes', | |
'not_found' => 'No athletes found' | |
); | |
register_taxonomy( | |
'athlete', | |
'post', | |
array( | |
'label' => __( 'Athlete' ), | |
'hierarchical' => false, | |
'labels' => $labels, | |
'public' => true, | |
'show_in_nav_menus' => false, | |
'show_tagcloud' => false, | |
'show_admin_column' => true, | |
'rewrite' => array( | |
'slug' => 'athletes' | |
) | |
) | |
); | |
} |
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
add_action( 'init', 'create_athlete_taxonomy' ); | |
function create_athlete_taxonomy() { | |
$labels = array( | |
'name' => 'Athletes', | |
'singular_name' => 'Athlete', | |
'search_items' => 'Search Athletes', | |
'all_items' => 'All Athletes', | |
'edit_item' => 'Edit Athlete', | |
'update_item' => 'Update Athlete', | |
'add_new_item' => 'Add New Athlete', | |
'new_item_name' => 'New Athlete Name', | |
'menu_name' => 'Athlete', | |
'view_item' => 'View Athlete', | |
'popular_items' => 'Popular Athlete', | |
'separate_items_with_commas' => 'Separate athletes with commas', | |
'add_or_remove_items' => 'Add or remove athletes', | |
'choose_from_most_used' => 'Choose from the most used athletes', | |
'not_found' => 'No athletes found' | |
); | |
register_taxonomy( | |
'athlete', | |
'post', | |
array( | |
'label' => __( 'Athlete' ), | |
'hierarchical' => false, | |
'labels' => $labels | |
) | |
); | |
} |
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
add_action( 'init', 'create_cars_taxonomy' ); | |
function create_cars_taxonomy() { | |
register_taxonomy( | |
'cars', | |
'post', | |
array( | |
'label' => 'Cars', | |
'hierarchical' => true, | |
'rewrite' => array( | |
'slug' => 'car-model' | |
) | |
) | |
); | |
} |
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
add_action( 'init', 'create_athlete_taxonomy' ); | |
function create_athlete_taxonomy() { | |
register_taxonomy( | |
'athlete', | |
'post', | |
array( | |
'label' => 'Athlete', | |
'hierarchical' => false, | |
) | |
); | |
} |
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
add_action( 'init', 'create_sports_taxonomy' ); | |
function create_sports_taxonomy() { | |
register_taxonomy( | |
'sports', | |
'post', | |
array( | |
'label' => 'Sports', | |
'hierarchical' => true, | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment