可以一舉兩得,使用taxonomies
鍵時registering the post type:
$product_labels = array(
'name' => _x('Products', 'post type general name'),
'singular_name' => _x('Product', 'post type singular name'),
'add_new' => _x('Add New', 'portfolio item'),
'add_new_item' => __('Add New Product'),
'edit_item' => __('Edit Product'),
'new_item' => __('New Product'),
'view_item' => __('View Product'),
'search_items' => __('Search Products'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);
$product_args = array(
'labels' => $product_labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array('slug' => 'product'),
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 2,
'supports' => array('title','editor', 'author', 'thumbnail', 'excerpt', 'comments', 'revisions', 'page-attributes', 'custom-fields',),
// Set the available taxonomies here
'taxonomies' => array('category', 'post_tag')
);
register_post_type('product', $product_args);
我已經回答了這個問題嘍。蛋糕給我! – CaseTA 2011-06-07 00:52:38
你可以在下面回答你自己的問題(並接受它)。這對其他人很有幫助,因爲它標誌着問題的解決。作爲一邊你讓自己一些代表... – 2011-11-09 01:09:00
大聲笑,我讀它,我認爲自己......「那麼這是什麼問題」。然後我閱讀你的評論。 – 2012-01-20 09:15:32