BUILDING YOUR FIRST WORDPRESS PLUGIN FROM SCRATCH- “EPISODE-1 of 3”
Hi, I am Ibraheem Zulkifli and i will be driving you to the new WordPress development world where you will discover what WordPress is and how to code a WordPress plugin from scratch in a very simple and straight to the point method.
This tutorial is for everyone who is ready to take flight in developing WordPress plugins or building for Wordpress generally. If you are a very beginner and don’t know what WordPress is, don’t worry. It is very easy to start at any time in WordPress. You should have at least beginner level knowledge of HTML/CSS , PHP/MYSQL to grasp the flow of plugins.
1.1 What is WordPress?
WordPress is an open source CMS (Content Management System) coded in PHP and MySQL. WordPress is completely free and it allows us to easily customize the look of our website using its themes and plugins architecture.
1.2 What is a WordPress plugin?
A WordPress Plugin is actually a single file or group of files which extends or enhances the functionality of a WordPress site. Without the use of plugins, WordPress is a little bit more like a blogging platform. For example, with the use of an e-commerce plugin, we can build e-commerce sites within WordPress. Using a membership plugin, a membership-based site can be built upon WordPress.
1. Getting Started
Are you ready?? OK, lets get started to build plugin now. I would recommend you install WordPress from http://wordpress.org/ and go step-by-step. We are using the latest 5.0 release of WordPress for this tutorial.
After downloaded Wordpress from the official website described above, you can now set up your development server on your local computer. If you don’t know how to do that kindly check here. The same process is applicable if you are using a PC or MAC.
After your Wordpress server in being set up and running on your local computer, the next step is to navigate to your Wordpress directory and locate wordpress-content folder and enter plugins folder. This folder will show all the plugins existing in your wordpress directory as shown in the image below.
Do you noticed a folder named zulkifli-plugin? You will need to create a folder with a name that doesn’t exist in the Wordpress plugin market, you can quickly confirm the name by searching the name of the wordpress plugin you are about to use in the dashboard for validation.
The next move is to launch your code editor and open your wordpress development file then locate plugins file and create a new file under it with the same name of the folder your created as shown in the image above but with the .php extension. that is, Zulkifli-plugin.php in my own case.
The next move is to start wring code properly for your plugin development as shown in the image below:
Hey there, Do you noticed @package ZulkifliPlugin? That is the global declaration of your wordpress plugin name for Wordpress to recognize your plugin.
So, you can now slap the save button and navigate to your wordpress dashboard then reload the page.
After your page is been reloaded, then you should see your new plugin dancing in your wordpress dashboard alongside with the existing wordpress plugins installed. The diagram below tells you what am talking about.
In the episode 2, i will be walking your through in understanding wordpress core functions associated with plugin development and all.
I hope you have learnt a lot in this straight to the point WordPress Plugin development tutorial. If you have any suggestions or ideas, do let me know in the comments below and don’t forget to rain some claps if you find this tutorial useful. Cheers!!!