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


Show an image on wordpress


I have several images that I want to show in some static pages on my wordpress site. I was wondering if I should load them from the Media Library. If so, what is the preferred function? Or should I load them from a images folder on my theme folder? If so, what should be the approach to keep them cached. Thank you,

Hi Elias,

What do you mean by static pages? Do you mean you haven't tied these pages into WordPress in any way?

I mean the pages are only templates without any additional dynamic content. This templates have different images including my site logo. Should I stick my logo on my theme images folder? Should I stick all other images on this pages on my themes folder too? Which is the best way to handle this? Upload them all to the Media Library. If so, how can I access them (including my logo) via functions?

1 Answer

Often for images I know are not going to change frequently, such as background images or the logo, I store them within an images directory, then in your html you could use:

<img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="Logo ALT Text">

That's a pretty basic example assuming you had an images folder within your theme and a logo image file that was logo.png.