Read This Post: Why you should be packaging a functionality plugin with your premium theme
If you’re going to be selling a WordPress theme with cool features, please make sure to move those features into a functionality plugin to go with the theme. Your customers will appreciate you even more.
Read This Post: What a custom functionality plugin is and why you should use one
A lot of tutorials have you put custom code in the functions.php file. But if it affects WordPress itself in anyway, that code should really go in a functionality plugin.