我想一个特色图片添加到我的主题,但不是文章或网页 - 我已经创建了一个名为自定义类型的属性(其为地产代理),所以我怎么能特色图片,因为它不会出现在sceen选择?
希望有人能帮助,
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor')
));
我想一个特色图片添加到我的主题,但不是文章或网页 - 我已经创建了一个名为自定义类型的属性(其为地产代理),所以我怎么能特色图片,因为它不会出现在sceen选择?
希望有人能帮助,
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor')
));
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor', 'thumbnail')
));
我似乎已经解决了自己的问题 - 见上
这可能帮助别人,
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' );
也许这将有助于
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' );
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' );
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' );