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 trial

WordPress WordPress Theme Development Custom Post Type Templates in WordPress Coding Your Own Custom Post Type Templates

Featured images is not showing

I followed the video and add this code in functions.php file

add_theme_support( 'post-thumbnails' );

but i didn't work for me. Then I go to CPT UI and in Add/Edit post type I go to Edit Post Type from the top tab and then select portfolio and at the bottom I checked the box of Featured Images and then save the post. After doing this it should show featured images option but it didn't. Can someone HELP ME???????

Jerad Johnston
Jerad Johnston
18,335 Points

I had to add it in like this in functions.php to get it to work

add_theme_support( 'post-thumbnails' , 'portfolio') );

or just use an array for other custom post, etc. like

add_theme_support( 'post-thumbnails' , array('post' , 'page' , 'portfolio') );

but looks like the CPT UI has been updated since these videos.

6 Answers

Chiedo Labs
Chiedo Labs
3,882 Points

For any future watchers make sure: You go to CPT UI => edit post type => select 'portfolio' => scroll all the way to the bottom => check supports: Featured Images.

Catherine Millington
Catherine Millington
3,754 Points

Mine wouldn't work either but I have now un-ticked the feature images (to show it) box on both the description and the image fields. Was just doing the image field before. Works now :o)

Stanley Thijssen
Stanley Thijssen
22,831 Points

Hey Jazib,

Make sure the featured image IS checked at the support section of your custom post type and then save it.

After that add:

add_theme_support( 'post-thumbnails' );

This should be working.

I checked both things are fine but again features images is not displaying

Stanley Thijssen
Stanley Thijssen
22,831 Points

What do you have checked at the support section?

Thanks Thijassen but featured image IS is checked at support and I saved it too but it didn't give the result.I'm stuck here

Stanley Thijssen
Stanley Thijssen
22,831 Points

Thats pretty weird.

Can you try to copy my function:

add_theme_support( 'post-thumbnails' );

save it and try again?

Michael Hanna
Michael Hanna
17,649 Points

Thank you, Stanley! That fixed my issue. I didn't have that box checked in my custom post type settings.

Samuel Schumacher
Samuel Schumacher
5,259 Points

Odd... I would try deleting your custom "portfolio" post type and then making a new one and see if that fixes things. If that doesn't work, you could try re-installing WordPress (while still keeping all your website content) by going to Dashboard -> Updates and click the "Re-install Now" button. See here on the WordPress Codex for more details.

Thanks! Yeah I already did that and now it's working fine. do u have skype? we can discuss more

Samuel Schumacher
Samuel Schumacher
5,259 Points

I actually don't use Skype very much, but if you have any more questions I'd be glad to help you with them on Treehouse! Also, if you could upvote the answer that solved your issue, I'd greatly appreciate it :)

I have the same problem. I tried the "re-install" and that hasn't worked either.

Samuel Schumacher
Samuel Schumacher
5,259 Points

I actually had this same issue when I learned how to do this. Here's what worked for me: Go to the "Custom Fields" tab (Advanced Custom Fields Plugin) and click your custom post type to edit it. Make sure that in the Options at the bottom of the page that "Featured Image" is NOT checked (checking this box means that WordPress will hide it).

Hope this fixes your issue!

featured image isn't checked annd same problem.....

I pasted ur statement although it was in functions.php file but nothing new.I try to go forward without that but my site was not showing images which I added later which could be due to unavailability of "featured images".