我有一个名为Section的分类法和一个名为Developments的自定义post类型。
我需要实现的是对分类法的永久链接,并带有前缀的自定义帖子类型:例如:
自定义帖子类型:开发多个自定义帖子类型需要是动态的分类法:部分术语:铸造
http://site.com/development/section/casting
我目前拥有的:
分类法:章节术语:铸造
http://site.com/section/casting
Permalink结构:帖子名称
PS*任何帮助都将不胜感激:
// Register Section taxonomy for Development, Pre-Production, Shooting & Post-Production
add_action( \'init\', \'jh_register_taxonomy_section\' );
function jh_register_taxonomy_section() {
$labels = array(
\'name\' => _x( \'Sections\', \'sections\' ),
\'singular_name\' => _x( \'Section\', \'sections\' ),
\'search_items\' => _x( \'Search Sections\', \'sections\' ),
\'popular_items\' => _x( \'Popular Sections\', \'sections\' ),
\'all_items\' => _x( \'All Sections\', \'sections\' ),
\'parent_item\' => _x( \'Parent Section\', \'sections\' ),
\'parent_item_colon\' => _x( \'Parent Section:\', \'sections\' ),
\'edit_item\' => _x( \'Edit Section\', \'sections\' ),
\'update_item\' => _x( \'Update Section\', \'sections\' ),
\'add_new_item\' => _x( \'Add New Section\', \'sections\' ),
\'new_item_name\' => _x( \'New Section\', \'sections\' ),
\'separate_items_with_commas\' => _x( \'Separate sections with commas\', \'sections\' ),
\'add_or_remove_items\' => _x( \'Add or remove sections\', \'sections\' ),
\'choose_from_most_used\' => _x( \'Choose from the most used sections\', \'sections\' ),
\'menu_name\' => _x( \'Sections\', \'sections\' ),
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'show_in_nav_menus\' => false,
\'show_ui\' => true,
\'hierarchical\' => true,
\'supports\' => array(\'title\', \'editor\', \'excerpt\', \'thumbnail\'),
\'rewrite\' => array(\'slug\' => \'section\', \'with_front\' => true, \'hierarchical\' => true),
\'query_var\' => true
);
register_taxonomy(\'sections\',array(\'development\',\'shoot\',\'pre_production\',\'post_production\'), $args );
}
// Register Developments custom post type
add_action(\'init\', \'jh_register_developments\');
function jh_register_developments() {
$labels = array(
\'name\' => __(\'Developments\', \'development\'),
\'singular_name\' => __(\'Development\', \'development\'),
\'add_name\' => __(\'Add New\', \'development\'),
\'not_found\' => __(\'No developments found\', \'development\'),
\'not_found_in_trash\' => __(\'No developments found in Trash\', \'development\'),
\'menu_name\' => __(\'Development\', \'development\')
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'has_archive\' => false,
\'supports\' => array(\'title\', \'editor\', \'excerpt\', \'thumbnail\'),
\'can_export\' => true,
\'rewrite\' => true,
\'menu_position\' => \'35\',
\'capability_type\' => \'post\'
);
register_post_type(\'development\', $args);
}