Calling a div and content in php?

I think that will only work in the loop, but what you can do outside of the loop is use

<?php
if (get_post_type() == 'pretty-little-liars') {
echo '<div id="headerimg"><img src="http://tv-cafe.com/wp-content/uploads/2012/08/liars.png"></div>'; 
} 
?>