Add code only for blog posts

It’s just that you got it a bit wrong – it’s actually

if(is_single())

(not singular). If you want to address pages in general (not posts I assume), you would use

if(is_page())

. If you need to address a specific page you could use its ID like so

if(is_page(13))

where 13 would be the ID of the page. But you have a lot of options – see http://codex.wordpress.org/Conditional_Tags .

However, of course you can use conditional tags in both header and footer (i.e. outside the loop) to tailor your template better ;).