How To Create a Plugin for Your Theme’s Custom Functions

Custom Functions PluginCreating a plugin isn’t hard at all. If you’ve created a child theme to save your custom coding, you’ll be able to create a plugin for the same purpose.

The reason i suggest you create a plugin is to save your custom coding from being lost when you update or change themes.

There’s many sites which offer free WordPress code snippets and advise you to add the code to your theme’s functions.php file.

This code will be overwritten when you update or change theme’s unless you add it to your child theme or create a customs functions plugin for your themes custom coding.

Tip: Always create a backup of your files or the file you are working on before working with php code.

Using notepad, add this code to a new file and save it as your custom functions plugin by sending it to zip file format.

<?php
/*
Plugin Name: wpssitescustomfunctions
Description: Custom php coding
Version: 0.1
License: GPL
Author: Brad Dalton
Author URI: http://wpsites.net/
*/

?>

Replace the plugin name, description, author and author uri with your own and start adding your custom php code between the  */  and before the closing php tag ?>

Save the file in a new folder with the same name as the plugin name and send to compressed zip folder by right clicking your mouse on the folder.

Install the plugin to enable the custom php functions code to work.

You can take this plugin to a new theme and not have to worry about your php code being lost.

You can add a description for each block of code and a html link back to the function on your site that was created with the code.

Related Solutions

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.