我正在尝试为我的自定义帖子类型创建归档页,但它将成为默认归档页,而不是我为归档创建的归档页
这是我自定义帖子类型的代码
// Register Custom Post Type
function gallery_post_type() {
$labels = array(
\'name\' => _x(\'Gallery images\', \'Post Type General Name\', \'horst\'),
\'singular_name\' => _x(\'Gallery image\', \'Post Type Singular Name\', \'horst\'),
\'menu_name\' => __(\'Photo Gallery\', \'horst\'),
\'name_admin_bar\' => __(\'Photo Gallery\', \'horst\'),
\'archives\' => __(\'Item Archives\', \'horst\'),
\'parent_item_colon\' => __(\'Parent Photo:\', \'horst\'),
\'all_items\' => __(\'All Photos\', \'horst\'),
\'add_new_item\' => __(\'Add New Photo\', \'horst\'),
\'add_new\' => __(\'Add New Gallery image\', \'horst\'),
\'new_item\' => __(\'New Photo\', \'horst\'),
\'edit_item\' => __(\'Edit Photo\', \'horst\'),
\'update_item\' => __(\'Update Photo\', \'horst\'),
\'view_item\' => __(\'View Photo\', \'horst\'),
\'search_items\' => __(\'Search Photos\', \'horst\'),
\'not_found\' => __(\'Not found\', \'horst\'),
\'not_found_in_trash\' => __(\'Not found in Trash\', \'horst\'),
\'featured_image\' => __(\'Gallery Image\', \'horst\'),
\'set_featured_image\' => __(\'Set Gallery image\', \'horst\'),
\'remove_featured_image\' => __(\'Remove Gallery image\', \'horst\'),
\'use_featured_image\' => __(\'Use as Gallery image\', \'horst\'),
\'insert_into_item\' => __(\'Insert into item\', \'horst\'),
\'uploaded_to_this_item\' => __(\'Uploaded to this Photo\', \'horst\'),
\'items_list\' => __(\'Photos list\', \'horst\'),
\'items_list_navigation\' => __(\'Photo list navigation\', \'horst\'),
\'filter_items_list\' => __(\'Filter Photo list\', \'horst\'),
);
$args = array(
\'label\' => __(\'Gallery image\', \'horst\'),
\'description\' => __(\'gallery imges for gallery page\', \'horst\'),
\'labels\' => $labels,
\'supports\' => array(\'title\', \'thumbnail\',),
\'hierarchical\' => true,
\'taxonomies\' => array(
\'gallery_categories\',
),
\'rewrite\' => array(
\'slug\' => \'gallery\',
),
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 5,
\'menu_icon\' => \'dashicons-format-gallery\',
\'show_in_admin_bar\' => true,
\'show_in_nav_menus\' => true,
\'can_export\' => true,
\'has_archive\' => true,
);
register_post_type(\'gallery\', $args);
}
add_action(\'init\', \'gallery_post_type\');
这是我的自定义分类法
// Register Custom Taxonomy
function custom_taxonomy() {
$labels = array(
\'name\' => _x( \'Gallery Maps\', \'Taxonomy General Name\', \'text_domain\' ),
\'singular_name\' => _x( \'Gallery Map\', \'Taxonomy Singular Name\', \'text_domain\' ),
\'menu_name\' => __( \'Gallery Maps\', \'text_domain\' ),
\'all_items\' => __( \'All Items\', \'text_domain\' ),
\'parent_item\' => __( \'Parent Item\', \'text_domain\' ),
\'parent_item_colon\' => __( \'Parent Item:\', \'text_domain\' ),
\'new_item_name\' => __( \'New Item Name\', \'text_domain\' ),
\'add_new_item\' => __( \'Add New Item\', \'text_domain\' ),
\'edit_item\' => __( \'Edit Item\', \'text_domain\' ),
\'update_item\' => __( \'Update Item\', \'text_domain\' ),
\'view_item\' => __( \'View Item\', \'text_domain\' ),
\'separate_items_with_commas\' => __( \'Separate items with commas\', \'text_domain\' ),
\'add_or_remove_items\' => __( \'Add or remove items\', \'text_domain\' ),
\'choose_from_most_used\' => __( \'Choose from the most used\', \'text_domain\' ),
\'popular_items\' => __( \'Popular Items\', \'text_domain\' ),
\'search_items\' => __( \'Search Items\', \'text_domain\' ),
\'not_found\' => __( \'Not Found\', \'text_domain\' ),
\'no_terms\' => __( \'No items\', \'text_domain\' ),
\'items_list\' => __( \'Items list\', \'text_domain\' ),
\'items_list_navigation\' => __( \'Items list navigation\', \'text_domain\' ),
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => true,
\'public\' => true,
\'show_ui\' => true,
\'show_admin_column\' => true,
\'show_in_nav_menus\' => true,
\'show_tagcloud\' => true,
);
register_taxonomy( \'gallery_categories\', array( \'gallery\' ), $args );
}
add_action( \'init\', \'custom_taxonomy\');
我不知道我哪里做错了?