Things I've Tagged ‘functions.php’

Page 1 of 1

#functions.php, #Plugins, #Web Design, #WordPress

WordPress Site Funtionality: Plugin or Functions.php?

If you’re developing websites using WordPress as your CMS, you’ve probably had to decide whether or not to create a plugin for that site’s functionality or to just dump it into your theme’s functions.php file. My solution used to be the latter, but lately I’ve found the former to be superior for one simple reason: themes are less permanent and more likely to be changed after you’ve passed it off to the client than a plugin. Hell, even I change my theme frequently enough for it to be an issue.

That news is likely old hat to you, but it took me a while to really see things that way. I’m not much of a serious developer, and so I don’t have extensive training or knowledge of programming models and logic, but I’ve always had an interest in it. Unfortunately, using object oriented programming wasn’t something that I understood how to do. Don’t get me wrong, I get the model, and how useful it is, I just never knew how to implement it logically, efficiently, and usefully.

I found, though, that as WordPress progressed, it was going to become quite useful to understand OOP on at least a basic level.

As it stands, I’m becoming heavily invested in developing for WordPress, and when I create a site now, I am generally going to be modifying the user experience in such a way as to require the creation of a plugin. This is to make sure clients aren’t doing something that breaks the site, or to shut down some unneeded functionality mostly, but occasionally I’m adding some handy widgets and custom post types.

Bottom line: if you need some Theme dependent functionality, the obvious choice is to keep it in the functions.php file, otherwise create a plugin to preserve that functionality across themes.