• Resolved redwing41

    (@redwing41)


    Hello,

    I’m trying to use an image from a folder in my child theme directory as a header background. As far as I can see it’s looking in the right directory, but for some reason not displaying the image.

    This is the code I’m using in the head of header.php:

    <?php if ( is_front_page() ) { ?><?php } else { ?> <style type="text/css"> #headerImage { background-image:url(<?php echo get_stylesheet_directory_uri(); ?>/images/image-1.jpg) !important}</style><?php } ?>

    It appears to be spitting out the desired directory and filename: /wp-content/themes/responsive-child/images/image-1.jpg

    Here is a reference page on the temporary site: http://myperformanceessentials.thepolymathlab.com/services/

    Please note: this is working on my local server, but not when uploaded to the web server.

    Any help is appreciated. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You may need to create an images folder in your Child Theme directory, then move that image, image-1.jpg in it.

    Thread Starter redwing41

    (@redwing41)

    I had that image in the folder.

    Converted it to a PNG and now it’s working fine!

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Header image from child theme directory not working’ is closed to new replies.