WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a anchor tag that wraps around my logo image that takes you back to the home page using the following

<a href="<?php bloginfo('url'); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="Good Morning Moon"/></a>

It is inside my header.php file. On my home page which is a staid page set to custom template with the following code it works

Template Name:Home Page
<?php get_header(); ?>

<?php get_footer(); ?>

However on any of my other pages which are using the default template which I assume is the index.php file I have setup based on looking at the http://codex.wordpress.org/Template_Hierarchy the anchor tag does not show up, my index.php file looks like so

<?php get_header(); ?>
<?php get_footer(); ?>

What could be causing this?

share|improve this question
up vote 1 down vote accepted

The code you're posting should work, as far as I can tell; however, you're using some outdated template tags.

Try replacing bloginfo( 'url' ) with echo home_url(), and bloginfo( 'template_directory' ) with echo get_template_directory_uri(), like so:

<a href="<?php echo home_url(); ?>">
    <img src="<?php echo get_template_directory_uri(); ?>/images/logo.png" alt="Good Morning Moon"/>

For more specific instruction, it would be very helpful to see the full code of the actual template/template-part files in question.

share|improve this answer
Thanks for the updated bloginfo params. I thought I read them directly from the codex I would expect that to be the best place to see the update ones. It is working now, I thought it wasn't because when I hovered over part of the image it didn't show a mouse over icon, but it does on another part probably need to add a height and width for it. – Anders Kitson Mar 12 '12 at 18:35
oh actually something was onto of it in css, so I added a z-index to the div. – Anders Kitson Mar 12 '12 at 18:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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