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

Why 'Featured image' is not showing on portfolios page while I added code in functions.php?

add_theme_support( 'post-thumbnails' );

I am trying to figure it out.

7 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

If you're using custom fields then you need to make sure that you still allow for the native featured image field to still show up. If you're not seeing that in the admin area then you may need to check your custom fields settings.

Thankyou for your quick response.

I did check mark 'Featured Image' in custom fields settings. I have no idea, why it still not seen yet on 'add portfolio' in admin area,

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

Is it available under Screen Options tab in the top right of the edit page. It may be hidden. Or, you may have selected to hide that field when you meant to include it.

I think it is hidden, I mean there is nothing 'Featured Image' under screen option tab. Where can I unhide it?

Thanks Zac you are great! Now problem solved! :)

You're right 'It may be hidden in Advanced Custom fields setting.

Edgar Chacon
Edgar Chacon
15,365 Points

Im getting this same issue.

I have

add_theme_support( 'post-thumbnails' );

right after the menus support

For the check boxes I have everything checked except Permalink, Slug and Featured Image.

Im also not able to see the attribute box with the order number.

Joseph Wachira
Joseph Wachira
17,972 Points

farhanasalman , I had the same problem but I found out you also need to make sure 'Featured Image' support is checked on your custom post settings.

Here's a screenshot of my WordPress dashboard to illustrate this:

screeshot

cc: Zac Gordon , Erik Krieg

Edgar Chacon
Edgar Chacon
15,365 Points

Thanks Joseph, that worked for me.

Mike Westfall
Mike Westfall
14,855 Points

Good find. Thanks for this!

Thanks Joseph, that worked for me too!

Agnes Caringal
Agnes Caringal
6,239 Points

Thanks Joseph, that worked for me too.

thank gawd

Enrico Imbalzano
Enrico Imbalzano
2,879 Points

Great, you pinpointed the problem exactly!! Thanks Joseph

Tasmiya Tabassum
Tasmiya Tabassum
8,115 Points

Thanks Joseph you are awesome

Brandon Barrette
Brandon Barrette
20,485 Points

So for anyone having issues on this, I finally got mine to work. Including what Joseph Wachira suggests above, you need to change your add_theme_support in the functions.php file to include the custom post type:

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

Here, add an array to include anything you want to have a featured image. I added post since I will want blog posts to have this as well.

Hope that helps anyone in the future =)

The problem is likely that your theme template for the portfolio pages does not actually include the code to place the featured image.

You will want to see something like the following in your template page

the_post_thumbnail();                  // without parameter -> Thumbnail

the_post_thumbnail('thumbnail');       // Thumbnail (default 150px x 150px max)
the_post_thumbnail('medium');          // Medium resolution (default 300px x 300px max)
the_post_thumbnail('large');           // Large resolution (default 640px x 640px max)
the_post_thumbnail('full');            // Original image resolution (unmodified)

the_post_thumbnail( array(100,100) );  // Other resolutions

Take a look here to a more complete idea how featured images are used: http://codex.wordpress.org/Post_Thumbnails

Thanks for the reply Erik. :)

I try to add code above but can't see 'Featured Image' on portfolio yet after I created add fields for custom post type UI and advanced custom fields plugin.

Errol Heywood
PLUS
Errol Heywood
Courses Plus Student 2,078 Points

In you post above you said that you 'did check mark 'Featured Image' in custom fields settings'. If you did tick the box you are selecting to 'Hide'.

It should be left unchecked.

Josh Horvath
Josh Horvath
2,378 Points

Thanks for your help Erik. I too was stumped by this.