Throughout this Anatomy Of A WordPress series I am going to be running through a number of the functions I use a lot and other items required when developing plugins. But, for the first post, it is probably best to start at the very beginning.
When creating a WordPress plugin, the first thing to do is to create the folder in which the files are to be stored. When doing so it is best to pick a name which is going to be unique; I am also typically giving them a name which will group all of my plugins together.
All of the plugins I have created so far have azurecurve at the start of the name. e.g.
Within the file create a php file of the same name with the php suffix:
Open the file and enter the php tags, between which all php code will be entered, at the top and bottom:
The final part of what I regard as the basics, is to add the file header, which contains the meta-information describing what the plugin is and who created it, between the php tags:
/* Plugin Name: < Name of the plugin (e.g. azurecurve RSS Suffix)> Plugin URI: < URI of the plugins homepage (e.g. http://development.azurecurve.co.uk/plugins/rss-suffix)> Description: <Shortdescription of the plugin (e.g. Add a suffix to rss entries)> Version: <Version Number (e.g. 1.0.0)> Author: <Name of the plugins author (e.g. azurecurve)> Author URI: <URI of the plugins author (e.g. http://development.azurecurve.co.uk)> License: <A short license slug (e.g. GPLv2)> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. The full copy of the GNU General Public License is available here: http://www.gnu.org/licenses/gpl.txt */
Of the above file header, only the Plugin Name is required to use the plugin on a WordPress site; the Version should be structured consistently between versions (e.g. 1.0.0 -> 1.0.1 -> 1.0.2 -> 1.1.0 -> etc.)
One final point when creating your plugin file; the file must be saved using UTF-8 encoding. This is the standard of Notepad++ which is my favourite tool when writing html or php.
|Anatomy Of A WordPress Plugin|
|Loading The CSS|
|Adding A Shortcode|
|Shortcode Extract Of Parameters|
|Adding Admin Menu For Options Page|
|Adding Admin Submenus For Options Pages|