Skip to content

Instantly share code, notes, and snippets.

@kharissulistiyo
Created July 11, 2015 11:47
Show Gist options
  • Save kharissulistiyo/68ee5d45b42c60a170a1 to your computer and use it in GitHub Desktop.
Save kharissulistiyo/68ee5d45b42c60a170a1 to your computer and use it in GitHub Desktop.
Creating Custom Taxonomy for Portfolio CPT of Toranj WP Theme
/*------------------------------------------------------------*/
/* Register Custom Portfolio Taxonomy */
/*------------------------------------------------------------*/
if ( ! function_exists( 'my_custom_portfolio_taxonomy' ) ) :
function my_custom_portfolio_taxonomy() {
$labels = array(
'name' => _x( 'Portfolio Categories', 'Taxonomy General Name', 'owlabpfl' ),
'singular_name' => _x( 'Portfolio Category', 'Taxonomy Singular Name', 'owlabpfl' ),
'menu_name' => __( 'Portfolio Categories', 'owlabpfl' ),
'all_items' => __( 'All Portfolio Categories', 'owlabpfl' ),
'parent_item' => __( 'Parent Portfolio Category', 'owlabpfl' ),
'parent_item_colon' => __( 'Parent Portfolio Category:', 'owlabpfl' ),
'new_item_name' => __( 'New Portfolio Category Name', 'owlabpfl' ),
'add_new_item' => __( 'Add New Portfolio Category', 'owlabpfl' ),
'edit_item' => __( 'Edit Portfolio Category', 'owlabpfl' ),
'update_item' => __( 'Update Portfolio Category', 'owlabpfl' ),
'separate_items_with_commas' => __( 'Separate portfolio categories with commas', 'owlabpfl' ),
'search_items' => __( 'Search portfolio categories', 'owlabpfl' ),
'add_or_remove_items' => __( 'Add or remove portfolio categories', 'owlabpfl' ),
'choose_from_most_used' => __( 'Choose from the most used portfolio categories', 'owlabpfl' ),
'not_found' => __( 'Not Found', 'owlabpfl' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => false,
'show_tagcloud' => true,
);
register_taxonomy( '_portfolio_category', array( 'owlabpfl' ), $args );
}
// Hook into the 'init' action
add_action( 'init', 'my_custom_portfolio_taxonomy', 0 );
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment