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 trialDebby Beachy
Courses Plus Student 2,096 PointsHelp please! My single-portfolio.php file is not show the images.
I looked at all of the threads and couldn't find my answer. I can see my text and my heading, but I can't see my image. Why?
If it's not the code...do I need to do something inside my ad-min?
Kate Moore
22,916 Pointsthank you! turns out I just made the same mistake :)
1 Answer
caroline
6,974 PointsI had the same problem! For some reason I had originally left the 'field name' area blank when setting up the custom fields. Then, when I realised this, it still didn't work because I'd used a capital 'I' for 'Images' in the field name, but here in <?php the_field('images'); ?> I'd used a lower case 'i'. It didn't work until I used a capital 'I' in the php like this: <?php the_field('Images'); ?> to match what was in the custom field. I guess php isn't very forgiving!
caroline
6,974 PointsOh, and just to add, I then had to go back to each portfolio piece and re-add the images into the WYSIWYG box as they hadn't previously saved (due to there being no 'field name' in the custom field). Only then did they show up on the page.
Debby Beachy
Courses Plus Student 2,096 PointsDebby Beachy
Courses Plus Student 2,096 Points[I found my answer!]
Just in case anyone else has this problem. My code is fine! However in my admin > custom fields > portfolio under field name I have a underscore after images.
single-portfolio.php <?php the_field('images_'); ?>
At first I didn't put the underscore after images. What is weird I didn't see this in Zac's video so I didn't catch it. After going over the video twice I figured it out made the change and all is working great!