Skip to content

Instantly share code, notes, and snippets.

@szbl
Last active December 15, 2015 07:49
Show Gist options
  • Save szbl/5226656 to your computer and use it in GitHub Desktop.
Save szbl/5226656 to your computer and use it in GitHub Desktop.
Adding taxonomy column to custom post type listing for my WordCamp San Diego 2013 presentation on Advanced Custom Post Types.
<?php
add_action( 'init', 'szbl_register_tax' );
function szbl_register_tax()
{
register_taxonomy(
'szbl-location-category',
array( 'szbl-location' ),
array(
'labels' => array(
'name' => __( 'Store Categories' ),
'singular_name' => _x( 'Store Category' ),
'search_items' => __( 'Search Store Categories' ),
'all_items' => __( 'All Store Categories' ),
'parent_item' => __( 'Parent Store Category' ),
'parent_item_colon' => __( 'Parent Store Category:' ),
'edit_item' => __( 'Edit Store Category' ),
'update_item' => __( 'Update Store Category' ),
'add_new_item' => __( 'Add New Store Category' ),
'new_item_name' => __( 'New Store Category Name' ),
'menu_name' => __( 'Store Categories' )
),
'public' => true,
'show_ui' => true,
'show_in_nav_menus' => false,
'show_tagcloud' => false,
// show the admin column
'show_admin_column' => true,
'hierarchical' => true,
'query_var' => true,
'rewrite' => array(
'slug' => 'location-category',
'with_front' => false,
'hierarchical' => true
)
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment