Код
// Register Custom Taxonomy
function portfolio_tags_taxononmy() {
$labels = array(
'name' => 'Portfolio Tag',
'singular_name' => 'Portfolio Tag',
'menu_name' => 'Portfolio Tags',
'all_items' => 'All Portfolio Tags',
'parent_item' => 'Parent Portfolio Tag',
'parent_item_colon' => 'Parent Portfolio Tag:',
'new_item_name' => 'New Portfolio Tag',
'add_new_item' => 'Add New Portfolio Tag',
'edit_item' => 'Edit Portfolio Tag',
'update_item' => 'Update Portfolio Tag',
'separate_items_with_commas' => 'Separate Portfolio Tags with commas',
'search_items' => 'Search Portfolio Tags',
'add_or_remove_items' => 'Add or remove Portfolio Tags',
'choose_from_most_used' => 'Choose from the most used Portfolio Tags',
'not_found' => 'Not Found',
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
);
register_taxonomy( 'portfolio-tags', array( 'portfolio' ), $args );
}
// Hook into the 'init' action
add_action( 'init', 'portfolio_tags_taxononmy', 0 );
Выводим
Now, you can use 'portfolio-tags' instead of 'post_tag':
register_taxonomy_for_object_type( 'portfolio-tags', 'portfolio' );
To generate your tag cloud, you can use wp_tag_cloud():
wp_tag_cloud( array( 'taxonomy' => 'portfolio-tags' ) );





