Utility Plugin for ClassicPress
Download your own utility plugin for ClassicPress! This provides a safe place for your site-specific code snips and tweaks! Remember, it is no longer recommended to add code snips to functions.php. Using a plugin instead, you'll even be able to activate and deactivate your code snips just like any plugin.
Utility Plugin Downloads
- Plugin A: prefixed, procedural PHP
- Plugin B: namespaced, procedural PHP
- Plugin C: object-oriented PHP
- Plugin D: object-oriented, namespaced PHP
Each version of the plugin contains a single example filter that changes the dashboard footer text. At this point, you may want to see the FAQ to learn how to rename the plugin. No worries, it's a quick process. From there, you can start adding your code snips directly to the PHP file in your plugin. And, don't forget: you can activate and deactivate your the plugin right in your dashboard.
By now, you probably have the utility plugin downloaded and installed. Going forward, you can place all your code snips into the utility plugin, rather than your functions.php file. Consequently, this means you can safely update your theme without losing your custom code snips.
Want to learn more about why you should use a utility plugin? If so, check out the thought process behind creating a utility plugin – it's well worth a read, even for non-coders. Oh yeah, there's also an article on converting a code snip into a utility plugin, if you're interested in seeing the process in the other direction.
Frequently Asked Questions
Why are there several versions of this plugin?
The utility plugin has been created in 4 versions. The reason for this is because some people are more comfortable with procedural PHP, others are more comfortable with object-oriented PHP. Some people use namespaces, others are perplexed by namespaces. To give you a utility plugin that immediately fits your own preferred code style, the different versions were created.
What are the differences between versions A, B, C, and D?
Only the code style differs from version to version. Version A is written in prefixed procedural PHP. Version B is written in namespaced procedural PHP. Version C is written in object-oriented PHP. Version D is written in namespaced and object-oriented code.
Which version of this plugin should I use?
You can use whichever version you prefer. If you want to write code like Code Potent, choose version D.
How can I change the plugin name?
First, if you have the plugin enabled, disable it. Next, rename the plugin’s main directory and the PHP file to match. For example, if you want a plugin called "ABC Utility", rename the directory to
abc-utilityand rename the PHP file to
abc-utility.php. Finally, in the PHP file, change the header details to reflect your own plugin name, description, URL, etc.
Does each version do the exact same thing?
Yes. However, don’t miss the not-so-obvious learning opportunity here! If you download all 4 versions and inspect the code side-by-side, it will provide a very enlightening (and easily-digestible) apples-to-apples comparison of how you can start thinking about more advanced programming techniques such as object-oriented programming and using namespaces.
Does this plugin work with WordPress?
It should. However, note that there are no features for Gutenberg and no WordPress-specific testing has been conducted. If you’d like to report your experience in using the plugin with WordPress, you can do so here.
Why are there directories for scripts, styles, images, etc?
The default directories inside the utility plugin are those that are most commonly needed in a utility plugin. Some utility plugins won’t need any of these directories while other plugins might need them all. They were included to give you a well-known directory naming schema to start with, just in case you’re super new to creating ClassicPress plugins. You can safely delete these directories if you don’t foresee a need for them.
The Utility Plugin plugin is released under the General Public License.
- ClassicPress 1.0.0 or later
- PHP 5.6 or later
Checksums – Coming Soon
Checksums allow you to verify the integrity of the plugin file.
There are no reported conflicts between the Utility Plugin plugin and other ClassicPress plugins or themes. If you experience something unexpected, please send an email!