Skip to content

Instantly share code, notes, and snippets.

@kovshenin
Created November 29, 2011 16:12
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 kovshenin/1405360 to your computer and use it in GitHub Desktop.
Save kovshenin/1405360 to your computer and use it in GitHub Desktop.
<?php
function vtp_install_data() {
add_action( 'init', 'vtp_setup_terms', 11 );
}
register_activation_hook( __FILE__, 'vtp_install_data' );
function vtp_setup_terms() {
if ( ! term_exists( 'Customer', 'account_type' ) ) {
wp_insert_term( 'Customer', 'account_type');
}
}
add_action( 'init', 'register_taxonomy_account_type' );
function register_taxonomy_account_type() {
$labels = array(
'name' => _x( 'Account Types', 'account type' ),
'singular_name' => _x( 'Account Type', 'account type' ),
'search_items' => _x( 'Search Account Types', 'account type' ),
'popular_items' => _x( 'Popular Account Types', 'account type' ),
'all_items' => _x( 'All Account Types', 'account type' ),
'parent_item' => _x( 'Parent Account Type', 'account type' ),
'parent_item_colon' => _x( 'Parent Account Type:', 'account type' ),
'edit_item' => _x( 'Edit Account Type', 'account type' ),
'update_item' => _x( 'Update Account Type', 'account type' ),
'add_new_item' => _x( 'Add New Account Type', 'account type' ),
'new_item_name' => _x( 'New Account Type Name', 'account type' ),
'separate_items_with_commas' => _x( 'Separate account types with commas', 'account type' ),
'add_or_remove_items' => _x( 'Add or remove account types', 'account type' ),
'choose_from_most_used' => _x( 'Choose from the most used account types', 'account type' ),
'menu_name' => _x( 'Account Types', 'account type' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_nav_menus' => true,
'show_ui' => true,
'show_tagcloud' => false,
'hierarchical' => true,
'rewrite' => true,
'query_var' => true
);
register_taxonomy( 'account_type', array('Accounts'), $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment