Skip to content

Instantly share code, notes, and snippets.

@blogjunkie
Created February 26, 2013 02:25
Show Gist options
  • Save blogjunkie/5035286 to your computer and use it in GitHub Desktop.
Save blogjunkie/5035286 to your computer and use it in GitHub Desktop.
Register custom taxonomies 1) quote topic and 2) quote author for quote custom post type
<?php
/**
* Taxonomies
*
* This file registers any custom taxonomies
*
* @package Core_Functionality
* @since 1.0.0
* @link https://github.com/billerickson/Core-Functionality
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*/
/**
* Create Location Taxonomy
* @since 1.0.0
* @link http://codex.wordpress.org/Function_Reference/register_taxonomy
*/
add_action( 'init', 'tdl_register_taxonomy_quote_topic' );
add_action( 'init', 'tdl_register_taxonomy_quote_author' );
function tdl_register_taxonomy_quote_topic() {
$labels = array(
'name' => _x( 'Quote Topic', 'tdl' ),
'singular_name' => _x( 'Quote Topic', 'tdl' ),
'search_items' => _x( 'Search Quote Topic', 'tdl' ),
'popular_items' => _x( 'Popular Quote Topic', 'tdl' ),
'all_items' => _x( 'All Quote Topic', 'tdl' ),
'parent_item' => _x( 'Parent Quote Topic', 'tdl' ),
'parent_item_colon' => _x( 'Parent Quote Topic:', 'tdl' ),
'edit_item' => _x( 'Edit Quote Topic', 'tdl' ),
'update_item' => _x( 'Update Quote Topic', 'tdl' ),
'add_new_item' => _x( 'Add New Quote Topic', 'tdl' ),
'new_item_name' => _x( 'New Quote Topic', 'tdl' ),
'separate_items_with_commas' => _x( 'Separate quote topic with commas', 'tdl' ),
'add_or_remove_items' => _x( 'Add or remove Quote Topic', 'tdl' ),
'choose_from_most_used' => _x( 'Choose from most used Quote Topic', 'tdl' ),
'menu_name' => _x( 'Quote Topics', 'tdl' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_nav_menus' => false,
'show_ui' => true,
'show_tagcloud' => true,
'hierarchical' => false,
'show_admin_column' => true,
'rewrite' => true,
'query_var' => true
);
register_taxonomy( 'quote_topic', array('quote'), $args );
}
function tdl_register_taxonomy_quote_author() {
$labels = array(
'name' => _x( 'Quote Author', 'tdl' ),
'singular_name' => _x( 'Quote Author', 'tdl' ),
'search_items' => _x( 'Search Quote Authors', 'tdl' ),
'popular_items' => _x( 'Popular Quote Authors', 'tdl' ),
'all_items' => _x( 'All Quote Authors', 'tdl' ),
'parent_item' => _x( 'Parent Quote Author', 'tdl' ),
'parent_item_colon' => _x( 'Parent Quote Author:', 'tdl' ),
'edit_item' => _x( 'Edit Quote Author', 'tdl' ),
'update_item' => _x( 'Update Quote Author', 'tdl' ),
'add_new_item' => _x( 'Add New Quote Author', 'tdl' ),
'new_item_name' => _x( 'New Quote Author', 'tdl' ),
'separate_items_with_commas' => _x( 'Separate quote authors with commas', 'tdl' ),
'add_or_remove_items' => _x( 'Add or remove Quote Authors', 'tdl' ),
'choose_from_most_used' => _x( 'Choose from most used Quote Authors', 'tdl' ),
'menu_name' => _x( 'Quote Authors', 'tdl' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_nav_menus' => false,
'show_ui' => true,
'show_tagcloud' => true,
'hierarchical' => false,
'show_admin_column' => true,
'rewrite' => true,
'query_var' => true
);
register_taxonomy( 'quote_author', array('quote'), $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment