Skip to content

Instantly share code, notes, and snippets.

@melissajclark
Created April 20, 2017 15:21
Show Gist options
  • Save melissajclark/0446fa3a34215ee3a00774f8682e6219 to your computer and use it in GitHub Desktop.
Save melissajclark/0446fa3a34215ee3a00774f8682e6219 to your computer and use it in GitHub Desktop.
taxonomy example
/**
*
* Register Line Sizes Taxonomy
*
**/
function trends_line_sizes_taxonomy() {
$labels = array(
"name" => __( 'Line Sizes', 'trends'),
"label" => __( 'Line Sizes', 'trends'),
"menu_name" => __( 'Line Sizes', 'trends'),
"all_items" => __( 'All Line Sizes', 'trends'),
"edit_item" => __( 'Edit Line Size', 'trends'),
"view_item" => __( 'View Line Size', 'trends'),
"update_item" => __( 'Update Line Size', 'trends'),
"add_new_item" => __( 'Add New Line Size', 'trends'),
"new_item_name" => __( 'New Line Size', 'trends'),
"parent_item" => __( 'Parent Line Size', 'trends'),
"parent_item_colon" => __( 'Parent Line Size:', 'trends'),
"search_items" => __( 'Search Line Sizes', 'trends'),
"popular_items" => __( 'Popular Line Sizes', 'trends'),
"separate_items_with_commas" => __( 'Separate Line Sizes with commas', 'trends'),
"add_or_remove_items" => __( 'Add or remove Line Sizes', 'trends'),
"choose_from_most_used" => __( 'Choose from most used Line Sizes', 'trends'),
"not_found" => __( 'No Line Sizes found', 'trends')
);
$args = array(
"labels" => $labels,
"hierarchical" => true,
"label" => "Line Sizes",
"show_ui" => true,
"query_var" => false,
"public" => true,
"rewrite" => array( 'slug' => 'line-sizes', 'with_front' => true ),
"show_admin_column" => true,
);
register_taxonomy( "line-sizes", array( "lines" ), $args );
}
add_action( 'init', 'trends_line_sizes_taxonomy' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment