Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJacques Esterhuizen
3,155 PointsFeature images not working in wordpress
Hey,
I have added support "add_theme_support( 'post_thumbnails');" for thumbnails into my functions.php file. For some reason when I want go and enter data in my custom post type, the feature image input doesn't appear.
Can someone please help. I have searched the Interwebs and can't find an answer.
7 Answers
Stanley Thijssen
22,831 PointsMaybe you can try this:
add_theme_support( 'post-thumbnails', array( 'your-custom-posttype-name' ) );
Jacques Esterhuizen
3,155 PointsYou are a life saver! Thanks Stanley! It works. So do I do this for every custom post type I presume ?
Stanley Thijssen
22,831 PointsIt depends.
Do you code the custom post types yourself or are u using a plugin?
But indeed you can just add the other posttypes u like to have the support
add_theme_support( 'post-thumbnails', array( 'your-custom-posttype-name', 'another', 'another2' ) );
Jacques Esterhuizen
3,155 PointsAt the moment plugins (CPT UI and Advance custom fields)
Jacques Esterhuizen
3,155 PointsBut thanks hey, you helped a lot!
Stanley Thijssen
22,831 PointsAlright,
I think if you just use add_theme_support( 'post-thumbnails' );
and you check the option 'Featured Image' at the bottom of the setting page 'Support section' of your custom post type, it should work too:)
Jacques Esterhuizen
3,155 PointsI tried it. It didn't work for some reason.
Stanley Thijssen
22,831 Pointsmake sure you change your function back to:
add_theme_support( 'post-thumbnails' );
and make sure you have selected the featured image at the support section of your custom post type settings page and it should work fine.
Jacques Esterhuizen
3,155 PointsIt works now for some reason. Thanks