I'd like to improve my code and on a current theme, I've extended Wordpress with custom post types, metadata, customized user authentication, and a number of other items.
Some of these functions exist in the functions.php file while I've put others directly on the template files that they relate to. I have little reason for doing this initially, other than it seemed appropriate because said template file was the only file using the specific function.
But I'd like to know what is considered best practice for the sake of speed and security? What do you do?