Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
Forked from billerickson/taxonomies.php
Created October 22, 2013 01:00
Show Gist options
  • Save jamiemitchell/7093559 to your computer and use it in GitHub Desktop.
Save jamiemitchell/7093559 to your computer and use it in GitHub Desktop.
<?php
/**
* Taxonomies
*
* This file registers any custom taxonomies
*
* @package CoreFunctionality
* @since 1.0.0
* @link https://github.com/billerickson/Core-Functionality
* @author Bill Erickson <[email protected]>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*/
/**
* Create Category Taxonomy
*
* @since 1.0.0
* @link http://codex.wordpress.org/Function_Reference/register_taxonomy
*/
function ea_register_category_taxonomy() {
$labels = array(
'name' => 'Product Categories',
'singular_name' => 'Category',
'search_items' => 'Search Categories',
'all_items' => 'All Categories',
'parent_item' => 'Parent Category',
'parent_item_colon' => 'Parent Category:',
'edit_item' => 'Edit Category',
'update_item' => 'Update Category',
'add_new_item' => 'Add New Category',
'new_item_name' => 'New Category Name',
'menu_name' => 'Categories'
);
register_taxonomy( 'products-category', array('products'),
array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'product-category' ),
)
);
}
add_action( 'init', 'ea_register_category_taxonomy' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment