• I’m pretty new to WordPress. I’ve created a child theme off of twentyeleven, and I am wanting to add a logo into the header. I can get the div dropped into header.php and customize it via CSS. When I use html to insert image:

    <div id=”logo”><img src=”../twentyeleven/images/SAAlogo.jpg” width=”180″ height=”54″></div>

    or css, it does not display. The alt text does display. All div characteristics display, but not the image. Seems like the code isn’t properly pointing to the image. I’m not coding it correctly so the doc can find it.

    I also tried:

    <div id=”logo”>”<?php echo get_stylesheet_directory_uri(); ?>/images/logo.jpg”</div>

    Same result.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You should be using an absolute file path. Upload the image to the media library and then look on the right side of the screen to find the File URL – copy that to the code in your header.php file.

    Thread Starter upstartadv

    (@upstartadv)

    The site is currently locally hosted. I thought my first attempt was an absolute path. I placed the image in the images folder in the parent, and then child theme. Neither worked.

    Here’s my div id:
    <div id=”logo”></div>

    I saw where the following code would work for child theme, but I’m not entirely sure where to place it.
    <?php echo get_stylesheet_directory_uri(); ?>/images/imagename.jpg

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Coding correct path to image source’ is closed to new replies.