我有以下功能。我的自定义主题的php:
<?php
add_theme_support( \'post-thumbnails\' );
add_image_size( "main-slider", 671, 252, true );
add_action( \'init\', \'create_main_slider_post_type\' );
add_action( \'init\', \'create_external_link_post_type\' );
function create_main_slider_post_type() {
register_post_type( \'main_slider_item\',
array(
\'labels\' => array(
\'name\' => __( \'Main Slider Items\' ),
\'singular_name\' => __( \'Main Slider Item\' ),
\'menu_name\' => __( \'Main Slider\' )
),
\'description\' => "A banner with a text and button",
\'public\' => false,
\'show_ui\' => true,
\'exclude_from_search\' => true,
\'show_in_nav_menus\' => false,
\'map_meta_cap\' => false,
\'supports\' => array(\'title\', \'thumbnail\'),
\'has_archive\' => false,
\'show_in_nav_menus\' => false,
)
);
}
function create_external_link_post_type() {
register_post_type( \'external_link\',
array(
\'labels\' => array(
\'name\' => __( \'External Links\' ),
\'singular_name\' => __( \'External Link\' ),
),
\'description\' => "A link with image for site footer",
\'public\' => false,
\'show_ui\' => true,
\'exclude_from_search\' => true,
\'show_in_nav_menus\' => false,
\'map_meta_cap\' => false,
\'supports\' => array(\'title\', \'thumbnail\'),
\'has_archive\' => false,
\'show_in_nav_menus\' => false,
)
);
}
?>
这段代码可以工作,因为可以通过在仪表板中看到“主滑块”和“外部链接”来确认这一点。
在“高级自定义字段”的配置中,main\\u slider\\u项作为“Post Type”的可能值消失了。(它仅显示“post”和“page”post内容类型。)它早就在那里了。
在哪里挖掘?
我试图禁用每个活动插件,但这没有帮助。