I'm just adapting and editing the code from the codex page on register_post_type() to also add some taxonomy.
The following code lives in my functions.php of my theme, but nothing happens. I am expecting the final line to add some taxonomy in my admin panel, but nothing!! Am I misinformed, or am I just plain stupid?
PHP Code:function my_custom_init()
{
$labels = array(
'name' => _x('Events', 'post type general name'),
'singular_name' => _x('Event', 'post type singular name'),
'add_new' => _x('Add New', 'Event'),
'add_new_item' => __('Add New Event'),
'edit_item' => __('Edit Event'),
'new_item' => __('New Event'),
'view_item' => __('View Event'),
'search_items' => __('Search Event'),
'not_found' => __('No Events found'),
'not_found_in_trash' => __('No events found in Trash'),
'parent_item_colon' => ''
);
/*$taxonomies = array(
'tax1' => 'tax1',
'tax2' => 'tax2'
);*/
$args = array(
'labels' => $labels,
//'taxonomies' => $taxonomies,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','author','thumbnail','excerpt','comments')
);
register_post_type('event',$args);
register_taxonomy_for_object_type('date', 'event');


LinkBack URL
About LinkBacks
Reply With Quote