• Resolved dnk3232

    (@dnk3232)


    Hi,

    I am trying to add a header image to my wordpress theme (which doesn’t come with one). I am new to PHP but I have gotten stuck.

    My website is: https://www.simply-elle.com/

    I added the following code to my child theme’s header.php file:

    <div id="header-image">
    <img id="topL" src="<?php echo get_stylesheet_directory_uri(); ?>"../images/simply-elle-header.jpg"/> 
    </div>

    The image is showing as an error for some reason. I’ve tried adjusting the path of it a few times but I cannot figure out how to correct this.

    Any help is greatly appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Why do you have ../ in the src? that says “in the directory above my theme. Try getting rid of the ..

    Thread Starter dnk3232

    (@dnk3232)

    I also noticed I had an extra set of quotations, which I have no got rid of.

    I got rid of the .. like you advised but still the same problem. My code is now:

    <div id="header-image">
    <img id="topL" src="<?php echo get_stylesheet_directory_uri(); ?>images/simply-elle-header.jpg"/> 
    </div>
    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    you need a / before images.

    Please provide a link to a page on your site where we can see this. Thanks.

    Thread Starter dnk3232

    (@dnk3232)

    Hi Steve,

    Thank you – the / was exactly what I needed. I appreciate the help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding header image to WordPress theme.’ is closed to new replies.