• I have wordpress on my laptop and I’m currently editing a custom theme offline. In my theme folder, I created an images folder. My background images work perfectly fine from this folder.

    I placed an image in that folder that I want to use within a paragraph in my header. However, <img src=”images/imagename.gif” …etc> returns nothing but a broken image. Just the alt description displays.

    Can someone tell me how to get an image to display in my theme? I also want to use this image as a link later on to a paypal shopping cart, but I’ll cross that bridge when I get there.

    Oh, and while I am here… what’s the difference between a theme and a template? I don’t plan to distribute this theme. It’s for use on one of my company’s sites.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You missed the first /images/imagename.gif:)

    Thread Starter courtelise

    (@courtelise)

    Unfortunately, that did not solve my problem.

    I can get it to display if I host it on Photobucket, but I would prefer to host it locally if I can.

    Thanks!

    Wait … you’re doing this locally – not from a web host? You’re not setup to localhost with a server and Apache on your laptop? If you’re not – you have to reference the local folder where the file is stored – your paths will not be the same as they would from a web host.

    Thread Starter courtelise

    (@courtelise)

    This is Local… on my laptop… just as I would build a regular site before posting it to the web.

    I have an images folder inside my theme folder. I referenced that images folder when calling for my background images in my CSS file just fine. But when I try to reference that folder to call for an image in my header.php file… it does not work.

    Is that folder referenced differently from a php file? Sorry, this is my first theme. 🙁 I appreciate the help.

    Edit to add… I use xampp if that helps.

    Courtelise,

    We’re two peas in a pot. I to am working on my first theme to release and ran into the same image problem. After finding your post and pouring through the forum, I found a solution.

    When you reference your image in the “img src” first place this php function after you open your quotations: <?php bloginfo(‘stylesheet_directory’); ?> and then reference the image as usual.

    Ex. <img src="<?php bloginfo('stylesheet_directory'); ?>/images/image.jpg" alt="whatever"/>.

    That should work. It worked for me. Hope this helps (especially if you still haven’t resolved the matter).

    By the way, I’m using MAMP on my Macbook to build the theme first. So the issue of whether the theme is being hosted locally or not shouldn’t really matter.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Adding image to my theme’ is closed to new replies.