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="https://wordpress.stackexchange.com/questions/45310/<?php echo home_url(); ?>">
<img src="<?php echo get_template_directory_uri(); ?>/images/logo.png" alt="Good Morning Moon"/>
</a>
For more specific instruction, it would be very helpful to see the full code of the actual template/template-part files in question.