我将此代码用于自定义post类型calles公文包。现在我想在项目之间使用父子关系。例如,我有一个URL为www.domain的公文包项目。de/portfolio-item1
另一个公文包项目应该是公文包项目1的子项目,url应该是www.domain。de/portfolio-item1/portfolio-item2
我是一个php初学者,我不知道如何才能实现这一点。谁能帮帮我吗?
// Portfolio Post Type
add_action(\'init\',\'wpthesis_create_portfolio_init\');
function wpthesis_create_portfolio_init() {
$labels = array
( \'name\' => _x(\'Portfolio\', \'post type general name\'),
\'singular_name\' => _x(\'item\', \'post type singular name\'),
\'add_new\' => _x(\'Add New\', \'Portfolio Item\'),
\'add_new_item\' => __(\'Add New Portfolio Item\'),
\'edit_item\' => __(\'Edit Portfolio Item\'),
\'new_item\' => __(\'New Portfolio Item\'),
\'view_item\' => __(\'View Portfolio Item\'),
\'search_items\' => __(\'Search Portfolio\'),
\'not_found\' => __(\'No portfolio items found\'),
\'not_found_in_trash\' => __(\'No portfolio items found in Trash\'),
\'parent_item_colon\' => \'\'
);
$support = array
(
\'title\',
\'editor\',
\'author\',
\'thumbnail\',
\'custom-fields\',
\'comments\',
\'genesis-seo\',
\'genesis-layouts\',
\'revisions\'
);
$args = array
(
\'labels\' => $labels,
\'public\' => TRUE,
\'rewrite\' => array(\'slug\'=>(\'produkte-leistungen\'),\'with_front\'=>false),
\'capability_type\' => \'page\',
\'hierarchical\' => FALSE,
\'query_var\' => true,
\'supports\' => $support, \'taxonomies\' => array(\'portfolio-category\'),
\'menu_position\' => 5
);
register_post_type(\'portfolio\',$args);
register_taxonomy(
\'portfolio-category\',
\'portfolio\',
array(
\'hierarchical\' => TRUE,
\'label\' => \'Categories\',
\'query_var\' => TRUE,
\'rewrite\' => FALSE,
)
);
}