I am developing my first wordpress theme. I have developed many for myself, and always used the full image url if placing an image in the index.php or header.php files (ie: the header/logo image or small icons next to “comments” and “permalink”) like so:
<img src="http://mydomain.com/wp-content/themes/themename/images/icon.gif" alt="comment icon" />
Now that I’m trying to make a theme for everyone to use, I have removed the full url to this:
<img src="wp-content/themes/themename/images/icon.gif" alt="comment icon" />
Which of course breaks the image if I navigate to another page or category page that inserts a new directory into the url.
I know I can fiddle with calling images in the CSS, but I didn’t want the header image to be a background, I want it clickable. Is there some kind of php string that will work inside the image tag to call the images from the right directory?
- The topic ‘image urls’ is closed to new replies.