Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

With this line everything works fine - (as a Non-Wordpress index.php):

<link href="style.css" rel="stylesheet" type="text/css"/> 

When I activate the file as a wp theme and replace above line with:

<link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet" type="text/css"/>

everything is ok, except - there are no images.

For example - a div with an image:

<div id="about">
<img id="thinker01" src="images/thinker01.png" width="120" height="163" />
</div>

images folder is inside theme's folder.

share|improve this question
1  
Where are these images stored? According to your source, your "images" folder must be located in the same place as index.php –  onetrickpony Dec 3 '12 at 16:10
    
@OneTrickPony, yes, it is. –  Alegro Dec 3 '12 at 16:11
1  
Just as a note: your stylesheet link really has no bearing on your problem; rather, the issue is with HTML image SRCs. –  Chip Bennett Dec 3 '12 at 16:14
add comment

2 Answers

up vote 1 down vote accepted

images folder is inside theme's folder.

But relative URLs do not work that way. They are relative to the URL not to the filesystem path. Your problem is here:

<img id="thinker01" src="images/thinker01.png" width="120" height="163" />

If you look at the request (via HttpFox or other means) you will see that the browser is looking for the image at http://your-site.com/images/thinker01.png and not at http://your-site.com/wp-content/themes/your-theme/images/thinker01.png Don't use relative URLs like that. Give it a complete path as you did with your stylesheet.

share|improve this answer
    
Thanks, s_ha_dum. I see now. Solved –  Alegro Dec 3 '12 at 16:17
add comment

you should declare the full url to your theme , eq:

<img id="thinker01" src="<?php bloginfo('template_url'); ?>/images/thinker01.png" width="120" height="163" />
share|improve this answer
1  
what I usuualy do is use 'replace' on my ide:<br /> fint: src="images/ replace to: src="<?php bloginfo('template_url'); ?>/images/ –  user1576978 Dec 3 '12 at 16:11
1  
+1, though you should use get_template_directory_uri() instead of bloginfo( 'template_url' ). –  Chip Bennett Dec 3 '12 at 16:13
    
Thanks a lot, solved –  Alegro Dec 3 '12 at 16:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.