• Resolved lanzagirl

    (@lanzagirl)


    I made some changes to the sidebar.php in the theme I am using (retro-book-10). I can’t understand why the image doesn’t show? Can anyone help me please?

    <div id=”SIDE”>

    <h2>English </h2><p>

    <h2>Menu</h2>

      <?php wp_list_pages(‘title_li=’ ); ?>
      <?php wp_list_categories(‘show_count=1&title_li=’); ?>

    <?php include (TEMPLATEPATH . ‘/searchform.php’); ?>

    <p>
    <h2><img src=”/images/crest.jpg”><h2>

    </div>

Viewing 4 replies - 1 through 4 (of 4 total)
  • This:

    /images/crest.jpg

    points to a directory called ‘images’ at the root of your site. So assuming a domain name of example.com, ‘images’ would be accessible as:

    example.com/images/

    is this the case for your images directory? I suspect rather the path to it is:

    /wp-content/themes/retro-book-10/images/

    so your best option in your template is to use WordPress’ ‘template_directory’ value for bloginfo() to output the path to your active theme’s directory, like so:

    <img src="<?php bloginfo('template_directory'); ?>/images/crest.jpg">

    EDIT: Missed my morning coffee. Removed reference to TEMPLATEPATH constant (which is bad for this) and stuck in the bloginfo() stuff.

    Could you explain more the difference between using TEMPLATEPATH and bloginfo(‘template_directory’)? Why pick one over the other?

    TEMPLATEPATH = actual (absolute) directory path on the host server. Useful for passing the path to the PHP include() function and whatnot (you can see its use in Lanzagirl’s code above).

    bloginfo('template_directory') = full url to the directory, which is what you want to provide in the case of say the src for an img element.

    Thread Starter lanzagirl

    (@lanzagirl)

    Thanks. That worked for me. I had tried it with http://www&#8230;.. etc. including that as you wrote it, before but it didn’t. Strange!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Image not showing’ is closed to new replies.