-2

I'm trying to customize twentyten theme.
this is part of header.php:

<body <?php body_class(); ?>>
<div id="wrapper" class="hfeed">
    <div id="header">

<img id="topL" src="images/img01.png"/> //this img I cannot insert  !   

</div><!-- #header -->

No errors. Simply - nothing happens.

6
  • Is there a public URL?
    – s_ha_dum
    Jan 4, 2013 at 21:44
  • @s_ha_dum, no, it's on my localhost :(
    – qadenza
    Jan 4, 2013 at 21:50
  • @toscho, Firebug shows all divs normally, including header div which is the parent div of the image, but there is no image inside, and there is no error.
    – qadenza
    Jan 4, 2013 at 21:55
  • Look at the real source, not at the rendered JS DOM.
    – fuxia
    Jan 4, 2013 at 21:56
  • @toscho, important, Firebug shows my starting code version - i. e. <img id="topL" src="/images/img01.png">
    – qadenza
    Jan 4, 2013 at 21:57

1 Answer 1

3

Don't use a relative URL. If you look at the source you are probably trying to load the image from http://sitename.com/images/ when what you likely want is http://sitename.com/wp-content/themes/themename/images/. Assuming the image is in the theme directory in a folder that shares a directory with style.css, do this:

<img id="topL" src="<?php echo get_stylesheet_directory_uri(); ?>/images/img01.png"/> 

http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri

3
  • s_ha_dum, the image is in the theme directory in a folder that shares a directory with style.css, yes it is, and I placed your code - and again - nothing !
    – qadenza
    Jan 4, 2013 at 21:42
  • 1
    I believe that should be echo get_stylesheet_directory_uri();
    – shea
    Jan 4, 2013 at 23:42
  • You are correct, @bungeshea.
    – s_ha_dum
    Jan 4, 2013 at 23:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.