我正在尝试添加一个特色图片到我的主题,但不是为帖子或页面-我已经创建了一个自定义类型称为属性(它的房地产代理),那么我如何启用特色图片,因为它没有出现在场景选项中?
希望有人能帮上忙
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor')
));发布于 2012-09-22 23:36:37
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor', 'thumbnail')
));我似乎已经解决了我自己的问题--见上文
发布于 2015-12-08 17:57:05
这可能会对某人有帮助
add_theme_support('post-thumbnails');
add_post_type_support( 'my_product', 'thumbnail' );
function create_post_type() {
register_post_type( 'my_product',
array(
'labels' => array(
'name' => __( 'Products' ),
'singular_name' => __( 'Product' )
),
'public' => true,
'has_archive' => true
)
);
}
add_action( 'init', 'create_post_type' );发布于 2019-03-28 19:55:12
100%处理此代码
add_theme_support('post-thumbnails');
add_post_type_support( 'news', 'thumbnail' );
function create_posttype() {
register_post_type( 'news',
array(
'labels' => array(
'name' => __( 'News' ),
'singular_name' => __( 'news' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'news'),
'menu_icon' => 'dashicons-format-aside',
)
);
}
add_action( 'init', 'create_posttype' );https://stackoverflow.com/questions/12543563
复制相似问题