Adding WordPress custom code to functions.php without writing a plugin
WordPress allows you to write a lot of custom functions but the problem with the wordpress is sometimes you need to write either a plugin or edit functions.php to add your custom functions to your wordpress blog
Writing a plugin is out of question as it takes a lot of time to develop and test it and for a small feature/functionality say like closing the comments on certain categories, it will be too cubersome
Whereas if you go with the second option of adding your own custom code to functions.php, whatever the custom code you wrote will be overwritten whenever you update your theme or wordpress.
Having faced with these problems I stumbled upon a plugin called “My Custom functions” which allows you add your custom code instead of at functions.php in theme
Once you have installed this plugin all you need to do is add the code as shown below and toggle on switch to make the code active!