In reply to Lobsang.

That code should, ideally, be inside of a plugin file.

You could also add it to your theme's functions.php file. Just don't forget to copy it over if you change themes in the future if you go this route.