Plugin Development

Plugin Development

What is a WordPress Plugin?

WordPress Plugin: A WordPress Plugin is a program, or a set of one or more functions, written in the PHP scripting language.

Creating a Plugin

When creating a WordPress plugin there are some standards to uphold to when doing so. Below I’ll outline some key points to remember when creating your own.

Plugin Files

Typically a plugin lives within its own folder under wp-content/plugins/ inside your WordPress installation. There is usually at least one PHP file that is typically named after the plugin. So if your plugin was named first-plug then your PHP file name would most likely be first-plug.php. Using a unique name is crucial so no two plugins use the same name.

Standard Plugin File

A plugin must contain a bit of meta information which tells WordPress what it is and how to handle it within your website. Plugins can be installed, deleted, activated, and inactivated. A standard header is introduced below to establish your plugin’s presence. The parameters shown will tell WordPress how to optimise it within your website and WordPress admin area.

<?php
/**
* Plugin Name: My First Plugin
* Plugin URI: http://mypluginuri.com/
* Description: A brief description about your plugin.
* Version: 1.0 or whatever version of the plugin (pretty self explanatory)
* Author: Galitein
* Author URI: http://www.galitein.com/
*/

With this information added, save your file and navigate to your WordPress admin area. Click on Plugins on the left side navigation and you should now see our plugin available.