WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to WP and PHP and I'm trying to convert my 'old' HTML theme into a WP theme. I created my index.php page and linked it to the style.css. I have some images in the css and, from what I've read, I've understood that I have to change my image url so that instead of having:

background-image: url(../assets/Logo.png);

I would have

background-image: url("<?php bloginfo('template_directory'); ?>/assets/Logo.png");

So I made this change on all the urls but when the index loads, even though every CSS element is fine, the images don't appear. However, if I revert them to the html url, the CSS doesn't display at all. And finally, if I have just one bloginfo url in the css and all the others are hmtl, the html ones will load, but the php one won't.

I've changed bloginfo to get_bloginfo (as some suggested) but still no solving. I went through all the parameters related to the path (template_url, stylesheet_directory), but still no change.

I would really appreciate some suggestions or explanations.

Thanks a lot!

share|improve this question
up vote 1 down vote accepted

If your style.css is in /wp-content/themes/themedirectory, and your image is at /wp-content/themes/themedirectory/images/image.jpg, then your css will be this:

background-image: url("images/image.jpg");

You can't use php in a css file, it will not parse unless included via php (instead of with <link>).

share|improve this answer

Your Answer


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.