Skip to content

Instantly share code, notes, and snippets.

@freerangetech
Last active August 29, 2015 13:59
Show Gist options
  • Save freerangetech/10471805 to your computer and use it in GitHub Desktop.
Save freerangetech/10471805 to your computer and use it in GitHub Desktop.
WordPress Custom Taxonomy Example
<?php
function create_custom_taxonomy() {
// Add new taxonomy, NOT hierarchical (like tags)
$labels = array(
'name' => _x( 'Academic Department or Program Tag', 'taxonomy general name' ),
'singular_name' => _x( 'Academic Department or Program Tags', 'taxonomy singular name' ),
'search_items' => __( 'Academic Department or Program Tags' ),
'popular_items' => __( 'Popular Academic Department or Program Tags' ),
'all_items' => __( 'All Academic Department or Program Tags' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit Academic Department or Program Tag' ),
'update_item' => __( 'Update Academic Department or Program Tag' ),
'add_new_item' => __( 'Add New Academic Department or Program Tag' ),
'new_item_name' => __( 'New Academic Department or Program Tag Name' ),
'separate_items_with_commas' => __( 'Separate academic department and program tags with commas' ),
'add_or_remove_items' => __( 'Add or remove academic department and program tags' ),
'choose_from_most_used' => __( 'Choose from the most used academic department and program tags' ),
'not_found' => __( 'No academic department and program tags found.' ),
'menu_name' => __( 'Department and Program Tags' ),
);
$args = array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'department-program' ),
);
register_taxonomy( 'dept_prog_tag', array( 'faculty_profile' ) , $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment