I’m trying to add a Featured Image to my theme but not for Posts or Pages – I’ve created a custom type called Properties (its for an estate agent), so how do I enable Featured Image, as it doesn’t appear in the sceen options?
Hope someone can help,
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor')
));
I appear to have solved my own question – see above
This might help someone,
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.
Note: Here, the
forum
is the post type name.You can keep this code in the
after_setup_theme
hook.Probably this would help
100% working this code
If you use wp cli and scaffold for creating your custom post-type:
wp scaffold post-type movie ...
You will find that your generated file (/post-type/movie.php) already has the line, in register_post_type:
supports: => ['title', 'editor' ]
And there you can add ‘thumbnail’:
supports: => ['title', 'editor', 'thumbnail' ]