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?
<?php wp_list_pages(‘title_li=’ ); ?>
<?php wp_list_categories(‘show_count=1&title_li=’); ?>
<?php include (TEMPLATEPATH . ‘/searchform.php’); ?>
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:
is this the case for your images directory? I suspect rather the path to it is:
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.
- The topic ‘Image not showing’ is closed to new replies.