Wordpress - adding Featured image to custom Post Type
Probably this would help
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' );
This might help someone,
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' );
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor', 'thumbnail')
));
I appear to have solved my own question - see above
You can simply enable support Post thumbnail for any custom post type with the following line of code in the theme's function.php file.
add_post_type_support( 'forum', 'thumbnail' );
Note: Here, the forum
is the post type name.
You can keep this code in the after_setup_theme
hook.