0

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.

  • 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
1

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.

|improve this answer|||||
2

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" />
|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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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