Functions.php is a little known wordpress template file. Not many themes take advantage of it but , used properly, it can be incredibly powerful. The file can be used as a way to add your own functions to wordpress themes (hence the name).
One of the common misconceptions, at least based upon my experience with a past wordpress tips and tricks post, is that editing functions.php involves changing core wordpress files – meaning there will be issues when you upgrade wordpress.
I am against changing core files in wordpress. This makes upgrading a nightmare.
What functions.php does is let you create functions you can reuse in the theme. It works like a plugin file, being loaded when the theme is first loaded. You can then use the functions inside for anything you choose. For example in my first tips and tricks post I suggested using it to separate trackbacks and comments. You can also use functions.php as to implement theme control panel pages as seen in Regulus (pretty much the first theme to have a control panel).
And how do you make use of functions.php? It couldn’t be simpler.
- Create a file called functions.php in your theme folder.
- Add functions to it.
The file automatically gets included into the theme, you don’t have to do anything.
Posted in: Web Design