从3.1升级到3.2,并在admin中丢失了在自定义帖子类型中运行的特色图像面板。
add_action( \'init\', \'create_my_post_types\' );
function create_my_post_types() {
register_post_type( \'header_image_gallery\',
array(
\'labels\' => array(
\'name\' => __( \'Header Images\' ),
\'singular_name\' => __( \'Header Image\' ),
\'add_new\' => __( \'Add New\' ),
\'add_new_item\' => __( \'Add New Header Image\' ),
\'edit\' => __( \'Edit\' ),
\'edit_item\' => __( \'Edit Header Image\' ),
\'new_item\' => __( \'New Header Image\' ),
\'view\' => __( \'View Header Images\' ),
\'view_item\' => __( \'View Header Images\' ),
\'search_items\' => __( \'Search Header Images\' ),
\'not_found\' => __( \'No Header Images found\' ),
\'not_found_in_trash\' => __( \'No Header Images found in Trash\' ),
\'parent\' => __( \'Parent Header Images\' ),
),
\'public\' => true,
\'supports\' => array(\'title\',\'thumbnail\',\'revisions\')
)
);
}
Post缩略图的注册方式如下:
// This theme uses post thumbnails
add_theme_support( \'post-thumbnails\', array(\'post\', \'page\') );
注意:升级之前创建的自定义帖子在前端正常工作,显示其帖子缩略图(只缺少特色图片管理面板)。
另外:我已经去了抄本,拉了一个自定义帖子类型的例子,你会注意到它应该显示一个特色图片>,但也没有。
add_action(\'init\', \'codex_custom_init\');
function codex_custom_init()
{
$labels = array(
\'name\' => _x(\'Books\', \'post type general name\'),
\'singular_name\' => _x(\'Book\', \'post type singular name\'),
\'add_new\' => _x(\'Add New\', \'book\'),
\'add_new_item\' => __(\'Add New Book\'),
\'edit_item\' => __(\'Edit Book\'),
\'new_item\' => __(\'New Book\'),
\'all_items\' => __(\'All Books\'),
\'view_item\' => __(\'View Book\'),
\'search_items\' => __(\'Search Books\'),
\'not_found\' => __(\'No books found\'),
\'not_found_in_trash\' => __(\'No books found in Trash\'),
\'parent_item_colon\' => \'\',
\'menu_name\' => \'Books\'
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'query_var\' => true,
\'rewrite\' => true,
\'capability_type\' => \'post\',
\'has_archive\' => true,
\'hierarchical\' => false,
\'menu_position\' => null,
\'supports\' => array(\'title\',\'editor\',\'author\',\'thumbnail\',\'excerpt\',\'comments\')
);
register_post_type(\'book\',$args);
}
如果我检查屏幕选项,则在两个示例中都看不到特征图像选项。
*回答了我自己的问题
也许在WP 3.1中,您在添加主题支持时不必声明自定义帖子类型,但在WP 3.2中,您可以这样做!
// This theme uses post thumbnails
add_theme_support( \'post-thumbnails\', array(\'post\', \'page\',\'header_image_gallery\') );