Being able to write your own plugins lets you write code that you can use on all your sites, regardless of the theme. Putting your code in a plugin is usually better practice than using the theme functions file. That way, you can switch themes without losing all the custom code on your site.
[…]