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 trialfarhanasalman
Front End Web Development Techdegree Student 2,830 PointsWhy '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
Treehouse Guest TeacherIf 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.
Joseph Wachira
17,972 Pointsfarhanasalman , 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:
cc: Zac Gordon , Erik Krieg
Edgar Chacon
15,365 PointsThanks Joseph, that worked for me.
Mike Westfall
14,855 PointsGood find. Thanks for this!
garsan
2,592 PointsThanks Joseph, that worked for me too!
Maxime Sénécal
5,529 PointsThanks Joseph, worked for me too :)
Agnes Caringal
6,239 PointsThanks Joseph, that worked for me too.
Elijah Collins
19,457 Pointsthank gawd
Enrico Imbalzano
2,879 PointsGreat, you pinpointed the problem exactly!! Thanks Joseph
Tasmiya Tabassum
8,115 PointsThanks Joseph you are awesome
Brandon Barrette
20,485 PointsSo 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 =)
eck
43,038 PointsThe 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
farhanasalman
Front End Web Development Techdegree Student 2,830 PointsThanks 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
Courses Plus Student 2,078 PointsIn 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
2,378 PointsThanks for your help Erik. I too was stumped by this.
farhanasalman
Front End Web Development Techdegree Student 2,830 Pointsfarhanasalman
Front End Web Development Techdegree Student 2,830 PointsThankyou 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
Treehouse Guest TeacherZac Gordon
Treehouse Guest TeacherIs 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.
farhanasalman
Front End Web Development Techdegree Student 2,830 Pointsfarhanasalman
Front End Web Development Techdegree Student 2,830 PointsI think it is hidden, I mean there is nothing 'Featured Image' under screen option tab. Where can I unhide it?
farhanasalman
Front End Web Development Techdegree Student 2,830 Pointsfarhanasalman
Front End Web Development Techdegree Student 2,830 PointsThanks Zac you are great! Now problem solved! :)
You're right 'It may be hidden in Advanced Custom fields setting.
Edgar Chacon
15,365 PointsEdgar Chacon
15,365 PointsIm 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.