Creating a plugin for custom code

In many of the guides we ask you to add code to your theme functions.php file, this can mean that when you update your theme the changes are wiped out (unless you are using a Child Theme – we recommend doing so).

One easy way to add the custom code to your site is using a plugin such as Code Snippets or My Custom Functions.

Another way to add the custom code to your site is to create a new plugin for it. It might sound complicated but it’s not. Using this method means the code will not be affected by theme updates and another advantage is that you can simply deactivate the plugin to stop the code being run. Create a new folder on your computer named quform-custom-code and inside it create a new text file and call it quform-custom-code.php and add this code inside the file:

1
2
3
4
5
6
7
8
9
10
<?php
 
/*
 * Plugin Name: Quform Custom Code
 * Description: Custom code for Quform.
 * Version: 1.0
 */
 
// Paste in your custom code below
 
<?php

/*
 * Plugin Name: Quform Custom Code
 * Description: Custom code for Quform.
 * Version: 1.0
 */

// Paste in your custom code below
 

On line 10 paste in the code from the guide you were following.

You can then zip up the quform-custom-code folder and install it like a normal WordPress plugin at Plugins → Add New → Upload.

Then to go the Plugins page within WordPress and activate the plugin Quform Custom Code. That's it!

Alternatively you can install the plugin using FTP software such as FileZilla, connect to your web server and go to the wp-content/plugins folder then upload the quform-custom-code folder there.

Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy