There may come time when you need to create your own WordPress plugin. It doesn’t have to be really complex as the fundamentals of a plugin are quite simple. I would recommend you making one to hold your blog’s custom functions. When you add custom functions to your WordPress theme you are essentially tying yourself to that theme forever. One day when you decide to change themes all your custom functions, like shortcodes, will be no more because they were coded into your old theme.
With your own custom functions plugin you can paste in any functions which then will be transferable across themes as long as you keep your plugin active.
For example, you may remember me mentioning the lovely Vicki Archer. I did a clean up of her blog last month and in the process we discussed some useful functions she could have to make blogging easier. Vicki has her desktop site design and is using theFEED on mobile. If I put her custom functions in her desktop theme, like her shortcodes, then on mobile they wouldn’t work as theFEED uses a separate theme.
With all this in mind I created a custom functions plugin for Vicki which we could add to whenever we wanted without disrupting our themes.
We are going to create a custom functions plugin called “My Blog Custom Functions”. To do this, you will need to create a new folder on your computer, and call it “my-blog-custom-functions”.
Inside this folder create a new file called “my-blog-custom-functions.php”. Bare in mind the file extension needs to be “.php”.
Next, open this new file and paste in the following at the top:
Plugin Name: My Blog Custom Functions
Then paste in any custom functions you would like to be called from this plugin. For example, in a previous tutorial I taught you how to make a shortcode function for your personal signature. Instead of pasting that code into your functions.php file within your theme, you can now paste it into your new custom functions plugin, so regardless of what theme you have your blog signature shortcode will work.
As and when you have more custom functions all you need to do is open up your “my-blog-custom-functions.php” file and paste in the function below the previous one.
To upload your new plugin, if you have access to your blog’s file manager or FTP you can add it to the plugins folder within wp-content folder of your WordPress site. If you don’t have access then simply zip your new plugin folder and upload it via the wordpress backend plugin uploader.
Here is an example of mine that I created for TheFashionTechnologist.com
And that’s it! Easypeasylemonsqueezy.