WordPress is a core platform, allows you to create modules within, which we call plugins, and they help to modify the reach of what your wordpress can do. Without editing core files,you can alter wordpress. This WordPress Plugin Development Guide will make you learn to code wordpress plugin.
Get Familiar with Directories
Before start working on your new wordpress plugin, you must know where the files are located. WordPress has very simple directory structure, and all the plugins are stored in /wp-content/plugins/. All the themes are stored in /wp-content/themes/. So, you will be working in the plugins directory, you need to create and edit files in the plugins directory only.
WordPress allows you to add or remove additional scripts and codes using hooks and filters, using which you can easily modify the current setup of your blog.
Check out this amazing Thrive quiz builder WordPress plugin if you haven’t checked it yet.
Getting Started with WordPress Plugin Development
There is basic need for every wordpress plugin, which would help you submitting your wordpress plugin right into the WordPress Plugins Directory. The basic need is to write down the identity of your wordpress plugin. According to WordPress Official Plugin Development guide, every plugin should have a readme.txt file where all the description will be written, which will be displayed in the WordPress Plugin Directory.
Alongwith readme file, your plugin must have a base php file where every code will be written. You can divide the plugin in multiple files too, but the base will be one, where all the files are included and called as and when required.
Basically, a simple wordpress plugin should be as simple as it can be, well written and everything valid. So, since it is your first plugin, you will need a base php file where all the contents of the plugin will be written, and a stylesheet file where all the css work will be done. So, lets get started with the core contents of the plugin. This is what you need to have in the header of the core file of your plugin.
<?php /* Plugin Name: Author Plugin URI: http://www.designskew.com Version: 1.0 Description: Plugin Description Goes Here. Author: DesignSkew Author UI: http://www.designskew.com/blog/ */
Change all the fields according to the functionality of your WordPress plugin. This description will be displayed in the Plugins listing in the WordPress Dashboard. Now, after this, but the functionality in the plugin using hooks, filters, and functions. Write the plugin, and don’t forget to test it on localhost first before making it available on Plugins Directory.
You will need to validate your plugin files before submitting them in the Plugin’s Directory. Here are some of the references you will need for validating your files.