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 Build a Website with WordPress Custom Post Types and Fields in WordPress Setting Up Custom Post Types and Fields

Ananda Johnson
Ananda Johnson
5,771 Points

Image Not showing up

So I followed all the steps but the images aren't showing up on the blog post. Is this because I am working locally? It shouldn't right? Everything is exactly the same as the video. Thanks for any insight as to why this might be happening!

Could you attach you code that is being used for a more clear idea of what is happening?

2 Answers

Ananda Johnson
Ananda Johnson
5,771 Points

Sure one moment will post it later today

Ivan Kozhunkov
Ivan Kozhunkov
Courses Plus Student 8,480 Points

Ananda, I'm sure, that I've got the same problem! Also, I don't see an image, a description and a price. Did you solve it?

nico dev
nico dev
20,364 Points

Hi Ananda Johnson (and whoever may bump into this wall in the future, just like me),

I am not sure if you had the same issue than I did, but I wondered the same thing, like is it because I'm doing it locally? It shouldn't right? Nope, you were right.

What happened to me, at least, was a really little but important mistake: when Zac typed "Image" (notice it's capitalized) in the Field Label, and then "image" in the Field Name, I didn't notice the switch, and then I typed them both capitalized.

Why would that give us an error? Well, the the_field() function is looking for a field named image, and only image, it won't accept any Image field name or nothing. For that reason, if you inspect the page once the image should have loaded you'll find unknown in the place where the src attribute should be pointing to the file.

So, in brief, if you had set the Field Name to something else than 'image' (no caps) change it to this and it should work. It did to me! :)

Hope it helps you or someone else that bumps into this.