我正在尝试向主题添加特色图片, 而不是为帖子或页面添加特色图片-我创建了一个名为”属性”的自定义类型(用于房地产经纪人), 因此如何启用特色图片, 因为它不会出现在场景选项中?
希望有人能帮忙
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor')
));
#1
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor', 'thumbnail')
));
我似乎已经解决了自己的问题-见上文
#2
这可能会帮助某人,
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' );
#3
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' );
#4
也许这会有所帮助
function create_post_type() {
register_post_type( 'sadaf_films', array(
'labels' => array(
'name' => __( 'Films' ), 'singular_name' => __( 'Film' )
), 'public' => true, 'has_archive' => true, 'supports' => array( 'title', 'editor', 'custom-fields', 'thumbnail' ), )
);
}
add_action( 'init', 'create_post_type' );
#5
add_theme_support('post-thumbnails');
add_post_type_support( 'testimonial', 'thumbnail' );
function create_posttype() {
register_post_type( 'testimonial', array(
'labels' => array(
'name' => __( 'Testimonial' ), 'singular_name' => __( 'testimonial' )
), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'testimonial'), // add category in custom post type
'taxonomies' => array( 'category'), )
);
}
add_action( 'init', 'create_posttype' );
来源:
https://www.srcmini02.com/64185.html