0

I needed to replace the #site-title text with an image and I found a great blog post explaining this:

http://bentcorner.com/replacing-wordpress-twenty-eleven-site-title-with-an-image/

But it appears that the image to be placed in background: url(/header.png) #fff no-repeat; must always lie in the root directory (~/public_html).

I am using a Twenty Elven child theme and I tried to place the image file in the images subdirectory of the child theme, but when I do this no image is visible. So far, the solution described in the article only works if the image is placed in the root directory.

Why is that?

Is there a way to allow the image to be placed in the images subdirectory of the child theme?

1 Answer 1

1

The / in header.png makes it look in the root directory.

Try just doing background: url(header.png) #fff no-repeat;

8
  • Thanks. I understand the role of the / but I tried background: url(images/header.png) #fff no-repeat; and various levels of url(../../images/header.png) #fff no-repeat; and that didn't work. Any idea why?
    – ef2011
    Feb 8, 2012 at 23:00
  • What are the actual paths for the theme stylesheet and the image itself? I'm assuming /public_html/wp-content/themes/theme-name has the stylesheet and /public_html/wp-content/themes/theme-name/images has header.png?
    – Kyle
    Feb 8, 2012 at 23:03
  • OK I tried your suggestion as well and it didn't work. Actual path for the theme stylesheet: /public_html/wordpress/wp-content/themes/child0/style.css. Actual path for the image: /public_html/wordpress/header.png. Your help is much appreciated. +1 for now.
    – ef2011
    Feb 8, 2012 at 23:41
  • @ef2011 What if it's just url(/wordpress/header.png)? Actually, your goal is to have it in /public_html/wordpress/wp-content/themes/child0/images right?
    – Kyle
    Feb 8, 2012 at 23:45
  • OK, I just moved the image to the same directory as the style.css and your suggestion works: /public_html/wordpress/wp-content/themes/child0/header.png. The question now is whether placing it in the images subdirectory of the the child theme can work.
    – ef2011
    Feb 8, 2012 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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