There is now a site-specific plugin framework available for customizing. Get it from Github.
What is a site specific plugin and why do I need one?
One of the most frequent questions I receive is, “What do I do with this code snippet? Where do I put it?”
The most generic (and not incorrect) answer is, “Your theme’s functions.php file.”
But the problem with putting your custom code (or at least all of it) in your theme functions.php is that if you update your theme, your customizations will be lost. Yes, you should be using a child theme, but the same can happen there if you’re using a commercial child theme. And of course, if (or when) you change themes, your customizations have to either be moved or lost.
Creating a custom plugin for storing your site’s customizations is a better way from an organizational point of view; and I’ve recommended that before on this site. This framework takes it a step further and provides you with a framework that will allow you to not only store you custom code snippets, but also load any custom CSS and JavaScript that you might need.
If your custom code is more layout related, perhaps it should still go into your theme functions.php, but anything specific to the plugin would make more sense in the site specific plugin. And of course, you can create as many of these as are necessary if you have a lot of custom code and want to keep it organized by plugin (this is not something specific to only WP-Members – this is for any plugin and/or WordPress itself).
How do I use it?
It’s pretty simple to set up, actually. Here’s how to do it locally:
- Get the framework and save it locally.
- Open the file /custom/functions.php and add your custom code snippet.
- FTP the files to your site.
- Activate the plugin.
Here’s another approach, using the WP file editor:
- Download the zip from Github.
- Upload it through the the WP plugin uploader (Plugins > Add New, click “Upload”).
- Activate the plugin.
- Open the plugin in Plugins > Plugin Editor.
- Select the /custom/functions.php file and add your code snippet.
The process of adding custom CSS or custom JavaScript is similar; just use the appropriate file – .css or .js.
If you break something, simply deactivate (or delete) the plugin.