Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created October 30, 2011 04:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/1325474 to your computer and use it in GitHub Desktop.
Save billerickson/1325474 to your computer and use it in GitHub Desktop.
Create Price Range Taxonomy
<?php
/**
* Create Price Range Taxonomy
* @author Bill Erickson
* @link http://www.billerickson.net/wordpress-custom-taxonomies/
*
*/
function be_register_price_range_taxonomy() {
$labels = array(
'name' => 'Price Ranges',
'singular_name' => 'Price Range',
'search_items' => 'Search Price Ranges',
'all_items' => 'All Price Ranges',
'edit_item' => 'Edit Price Range',
'update_item' => 'Update Price Range',
'add_new_item' => 'Add New Price Range',
'new_item_name' => 'New Price Range Name',
'menu_name' => 'Price Range'
);
register_taxonomy( 'price-range', array('projects'),
array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'price-range' ),
)
);
}
add_action( 'init', 'be_register_price_range_taxonomy' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment