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 trialRonny Ewanek
4,385 PointsImages Don't Appear
I exactly followed the steps of the lessons and my images are not appearing, and it's frustrating. This is what inspection reveals:
<img src alt="Example image of Example 1">
It's as if it's not reading the link and I'm not sure why. I've tried updating content-art.php by changing "image" to "art" but that didn't work as well.
<p><img src="<?php the_field('image'); ?>" alt="Example image of <?php the_title(); ?>"></p>
I would appreciate any assistance. There's not much code to post since I simply used the files provided by the lesson.
5 Answers
Rich Bagley
25,869 PointsHi Ronny,
What return value did you select? It will need to be image URL to display as you want based on your code sample. The field name will also need to match image.
The documentation gives examples of other methods of implementing it if needed.
-Rich
Ronny Ewanek
4,385 PointsHey Rich! Thank you for your response. Can you be more specific when you say "return value"? I followed the course instructions closely and selected image URL in the image field group. Field label, name, and type are all "image". I do have the following in content-art.php:
<p><img src="<?php the_field('image'); ?>" alt="Example image of <?php the_title(); ?>"></p>
Did you follow the course as it is and work for you? I'm not really a noob when looking at code, however WP codex is new to me. I should mention that I am running this on local host.
Rich Bagley
25,869 PointsHi Ronny,
No problem and sorry about the delayed reply.
For the return value I just mean the image URL, object, etc. options so looks like you're using that fine anyway.
Honestly, I haven't built this project. I tended to follow it through and (after making sure I know it) then use what I've learned on my own projects. If it's any use, I also tend to use the image object. This allows you to return the alt tag associated with the image in the media library.
I've just had a look through some of the other questions associated with that video and some of the students have said that after they've downloaded a later version of the project it seems to correct itself. If you try this I'd still recommend backing up what you have already just in case.
Sorry I couldn't be more help but hopefully you find the information useful in some way.
-Rich
Ronny Ewanek
4,385 PointsI saw about the "later" version of the project, but this is the last session...so where is the "later version?"
Rich Bagley
25,869 PointsBased on the video you've linked to this is the last session of that particular section (Custom Post Types and Fields in WordPress) but there are another 2 sections listed here.
-Rich
Ronny Ewanek
4,385 PointsCorrect me if I'm wrong the the other sections deal with custom menus and plugins. The download folder only contains the footer and functions.php files for the lesson. Sorry I'm kind of lost on where to find these files, and you seem to be the only one here!
Rich Bagley
25,869 PointsHi Ronny,
No problem, under the video in the later sections there should be a Downloads tab. Under that will be the Project Files. This should contain a more up-to-date version of the project.
Please make sure you check those files / back up your own before uploading them though.
-Rich
Ronny Ewanek
4,385 PointsHey Rich!
I have a bit more detail for you. When I attempt to upload, lets say, "Example 4" colored square, that's in the media library, to an Art post, the image doesn't stay after hitting Update.
Any ideas?