As you can see from below, the logo is in the same folder as header.php. I do the relative image reference in header.php by

img src="logo.png"

Its not working. Please help

enter image description here



1 Answer 1


if the png lies directly in your theme folder try this:

img src="<?php echo get_template_directory_uri(); ?>/logo.png"
  • Thanks. It worked. However, I could you give me an answer to another option I tried and not worked. I tried get_template_directory_uri. '/images/logo.png' where the logo was inside images. But did not work. When I inspected the elements, the hyperlink was correct and I verified it by pasting that link in another tab. The image showed up. But not in the main file
    – jeff
    Commented Apr 22, 2017 at 5:19
  • it should work. can you post a link to your site or show the produced html?
    – am_
    Commented Apr 22, 2017 at 6:03

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.