Custom posts custom taxonomy
-
I’m looking for little help. I have code to create custom-posts but I need to add custom taxonomy to it. I need both type of taxonomy categories and tags and categories need to be hierarchical.
Here is the code I use in function.php
// custom-post
//
$labels = array(
‘name’ => __(‘Custom-Post’),
‘singular_name’ => __(‘Custom-Post’),
‘add_new’ => __(‘Add New Custom-Post’),
‘add_new_item’ => __(‘Add New Custom-Post’),
‘edit_item’ => __(‘Edit Custom-Post’),
‘new_item’ => __(‘New Custom-Post’),
‘view_item’ => __(‘View Custom-Posts’),
‘search_items’ => __(‘Search Custom-Posts’),
‘not_found’ => __(‘No Custom-Posts found’),
‘not_found_in_trash’ => __(‘No Custom-Posts found in Trash’),
‘parent_item_colon’ => ”
);
$args = array(
‘labels’ => $labels,
‘singular_label’ => __(‘Custom-Post’),
‘public’ => true,
‘show_ui’ => true,
‘capability_type’ => ‘post’,
‘hierarchical’ => false,
‘rewrite’ => true,
‘has_archive’ => true,
‘supports’ => array(‘title’, ‘editor’, ‘author’, ‘excerpt’, ‘custom-fields’, ‘comments’),
// ‘taxonomies’ => array(‘category’)
);
register_post_type(‘Custom-Post’, $args);//
I’ll appreciate if someone could give me another part which can create custom taxonomies.
I know about plugins for custom-posts and custom taxonomies, but in my case I can’t use plugins, I need it in functions.phpThank you in advance.
- The topic ‘Custom posts custom taxonomy’ is closed to new replies.