WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Header image from child theme directory not working (3 posts)

  1. redwing41
    Member
    Posted 1 year ago #

    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!

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

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

  3. redwing41
    Member
    Posted 1 year ago #

    I had that image in the folder.

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

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic