admin管理员组文章数量:1429841
I have thumbnail support added with the following in my functions.php
// Add Thumbnail Support
add_theme_support('post-thumbnails');
set_post_thumbnail_size( 140, 140, true );
And I create the custom post type with
// Create Custom Post Type for Work
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'custom_post',
array(
'thumbnail',
'labels' => array(
'name' => __( 'Custom' ),
'singular_name' => __( 'Custom' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'custom'),
'taxonomies' => array('category', 'post_tag')
)
);
}
However, when I create a new post in the Custom Post Type, the Featured Image meta box does not show. I have also tried using an array when declaring the custom post type, as follows but that didn't work either
// Add Thumbnail Support
add_theme_support('post-thumbnails', array ('post','work','custom_post'));
set_post_thumbnail_size( 140, 140, true );
What am I missing?
I have thumbnail support added with the following in my functions.php
// Add Thumbnail Support
add_theme_support('post-thumbnails');
set_post_thumbnail_size( 140, 140, true );
And I create the custom post type with
// Create Custom Post Type for Work
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'custom_post',
array(
'thumbnail',
'labels' => array(
'name' => __( 'Custom' ),
'singular_name' => __( 'Custom' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'custom'),
'taxonomies' => array('category', 'post_tag')
)
);
}
However, when I create a new post in the Custom Post Type, the Featured Image meta box does not show. I have also tried using an array when declaring the custom post type, as follows but that didn't work either
// Add Thumbnail Support
add_theme_support('post-thumbnails', array ('post','work','custom_post'));
set_post_thumbnail_size( 140, 140, true );
What am I missing?
Share Improve this question asked May 11, 2012 at 16:01 RyanRyan 6962 gold badges12 silver badges24 bronze badges3 Answers
Reset to default 67try the register_post_type
supports
parameter:
'supports' => array( 'thumbnail' )
Add this parameter into your array:
'supports' => array('thumbnail'),
Edit: Milo was faster.
Try this it works for me.....
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' );
本文标签: functionsHow come Featured Image isn39t showing up in my Custom Post Type
版权声明:本文标题:functions - How come Featured Image isn't showing up in my Custom Post Type? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745554162a2663082.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论