The functions.php file is an important element in customizing WordPress. It is also an important element in terms of customizing and integrating WP-Members into your site.
While you are not required to do any customization to get WP-Members to work on your site (it is, after all, a plugin), to leverage the power of the framework and thus make it look professional and seamless on your site, you will need to have some knowledge of the functions.php file.
The WordPress Codex defines the functions.php file like this:
A theme can optionally use a functions file, which resides in the theme subdirectory and is named functions.php. This file basically acts like a plugin, and if it is present in the theme you are using, it is automatically loaded during WordPress initialization (both for admin pages and external pages). Suggested uses for this file:
- Enable Theme Features such as Sidebars, Navigation Menus, Post Thumbnails, Post Formats, Custom Headers, Custom Backgrounds and others.
- Define functions used in several template files of your theme.
- Set up an options menu, giving site owners options for colors, styles, and other aspects of your theme.
The default WordPress theme contains a functions.php file that defines many of these features, so you might want to use it as a model. Since functions.php basically functions as a plugin, the Function_Reference list is the best place to go for more information on what you can do with this file.
Adding Customizations to functions.php
Whether or not you are doing your customizations in a Child Theme is a topic for a separate discussion. For now, just suffice to say that much of the example code given on this site in terms of hooking into WP and WP-Members will go into your functions.php file.
This file will begin with an opening php delimiter: <?php
It may or may not close with a closing delimiter: ?>
What if I don’t have a functions.php file in my theme?
Most themes have a functions.php file. If yours does not, it’s ok to just create one. It just needs to be named functions.php, be saved to your theme’s root folder, and open/close with <?php …all of your lines of code in between… ?>
You can refer to the functions.php file that is included with the WordPress default themes (TwentyTen & TwentyEleven) as a guide or a starting point.
Some themes have a custom functions file that gets loaded by the theme. Sometimes this might be called something as obvious as custom-functions.php. If you have a theme framework like Thesis or Genesis, it is quite possible that you’ll be putting your custom functions in a custom functions file rather than directly into functions.php. Consult your theme documentation on this.
When in doubt, ask the theme developer. They’ll know.
You don’t have to be a code junkie or developer to be able to leverage functions.php to your advantage. And if you are testing things out on a testing server rather than working on your live site, this shouldn’t be complicated, frustrating, or scary. (You do follow work flow best practices by testing everything in a testing environment, don’t you?)