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

Deanna Morale
Deanna Morale
3,773 Points

Can someone please help me. My images are not showing up in wordpress. Ive rebuilt the site twice and still nothing.

My links are correct- even with the bare php files. Everything shows in front-page, header and footer except images. Ive deactivated my functions file as well. My html is correct as: src="images/facts1.png"

..as an example and shows in my regular html. My images folder path is in the theme file. What could possibly be wrong? I'm at my wits end but I don't see the point in moving on if I can't even get the images to show up. Where is ZAC!!!

5 Answers

Kevin Korte
Kevin Korte
28,149 Points

Is this site public? How are you adding images? In a post body, feature image, another plugin?

Deanna Morale
Deanna Morale
3,773 Points

Its local. I just inserted the html from a site I already created just regular site into the php and tested it and it all shows and is getting header and footer properly- just no images.. Do the images not show up as a local site?

Kevin Korte
Kevin Korte
28,149 Points

If the images path is correct, they'll show up local. So you've uploaded the images in wordpress via it's media uploader, but you're referencing the images using custom html/php and not any sort of built in WP image helper, correct?

Sounds like your image paths might not be correct. Your image paths would definitely change between your regular site, and the wordpress site.

Deanna Morale
Deanna Morale
3,773 Points

i tried uploading via media library and replacing permalink in but still nothing.

Christophe Rudyj
seal-mask
.a{fill-rule:evenodd;}techdegree
Christophe Rudyj
Full Stack JavaScript Techdegree Student 13,011 Points

in wordpress in a template your images needs to have get_template_uri() because the images are actually stored in /.../wp-content/themes/(insert theme name here)/images/

Deanna Morale
Deanna Morale
3,773 Points

It worked!!! thank you!!:)

Doru Marginean
Doru Marginean
2,290 Points
You should use get_template_directory_uri() or get_stylesheet_directory_uri() for child themes.
eg.
<img src="<?php echo get_template_directory_uri(); ?>/images/image.jpg" />