(The changes you need to make are fairly simple, just one extra line and a few slight changes. I've attached the code to this post, just replace what you pasted into your theme's header with this version.)