Skip to content

Instantly share code, notes, and snippets.

@macgraphic
Last active July 10, 2018 09:37
Show Gist options
  • Save macgraphic/2772fef23cba1da797a2d4f33679f4e2 to your computer and use it in GitHub Desktop.
Save macgraphic/2772fef23cba1da797a2d4f33679f4e2 to your computer and use it in GitHub Desktop.
// Add Supporter Levels (Taxonomies)
// Register Custom Taxonomy
function supporter_lvl_taxonomy() {
$labels = array(
'name' => _x( 'Supporter Levels', 'Taxonomy General Name', 'text_domain' ),
'singular_name' => _x( 'Supporter Level', 'Taxonomy Singular Name', 'text_domain' ),
'menu_name' => __( 'Supporter Levels', 'text_domain' ),
'all_items' => __( 'All Levels', 'text_domain' ),
'parent_item' => __( 'Parent Item', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'new_item_name' => __( 'New Level', 'text_domain' ),
'add_new_item' => __( 'Add New Level', 'text_domain' ),
'edit_item' => __( 'Edit Level', 'text_domain' ),
'update_item' => __( 'Update Level', 'text_domain' ),
'view_item' => __( 'View Level', 'text_domain' ),
'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),
'add_or_remove_items' => __( 'Add or remove items', 'text_domain' ),
'choose_from_most_used' => __( 'Choose from the most used', 'text_domain' ),
'popular_items' => __( 'Popular Items', 'text_domain' ),
'search_items' => __( 'Search Items', 'text_domain' ),
'not_found' => __( 'Not Found', 'text_domain' ),
'no_terms' => __( 'No Levels', 'text_domain' ),
'items_list' => __( 'Levels list', 'text_domain' ),
'items_list_navigation' => __( 'Levels list navigation', 'text_domain' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'tax_position' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'rewrite' => true,
'show_tagcloud' => true,
'hide_empty' => true,
'show_in_rest' => true,
'capabilities' => array(
'manage_terms' => true,
'edit_terms' => true,
'delete_terms' => true,
'assign_terms' => true,
),
);
register_taxonomy( 'supporter_level', array( 'supporters' ), $args );
}
add_action( 'init', 'supporter_lvl_taxonomy', 0 );
add_filter( 'radio_buttons_for_taxonomies_no_term_supporter_level', '__return_FALSE' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment