You should have a look at using conditional tags in wordpress. is_single()
is the conditional tag for a single page, ie single.php.
For homepage, is_home()
or is_front_page()
should be use, depending on whether a front page is set in settings or not.