12
WP Plugin Development – Plugin Setup
No comments · Posted by johng in Wordpress, Wordpress Plugin Development
The goal of this plugin is to provide a way for the user to change the font size of text on a wordpress site using jQuery. This post will cover the initial setup of the plugin folder structure and files.
Setup Plugin Structure
The first thing that needed to be done is to setup a folder structure and create the initial plugin PHP file. I prefer to seperate different parts of projects into folders to keep things organized. For the elasticFonts plugin, this is how my initial folder setup looked.

Wordpress plugin folder structure
Of Interest
- The root folder of the plugin is named after the plugin
- The main plugin file is located in the root and named after the plugin
- I created folders for CSS, Javascript code, and and images
Code Basic Plugin Features
The next thing that needed to get done was to setup the plugin file so that it would be visible to wordpress. This is actually very simple as the plugin doesn’t need to do anything at this point. I added comments to the main plugin file following wordpress recommendations found here. This information includes basic information on the plugin as well as the license information. WordPress gets information about the plugin from the basic information section. This is the commented code that is used for that purpose.
/*
Plugin Name: elasticFonts
Plugin URI: http://codedeveloper.net/elasticFonts
Description: This plugin is used to change the size of fonts
Version: .1
Author: John Gilligan
Author URI: http://codedeveloper.net
*/Of Interest
- The plugin name is what I have called the main PHP file
- I included a webpage for the plugin that will be developed
- I gave it a description, this will be how the plugin is described in the WordPress admin
- I also included the version, author, and website
I also chose to add in the license information and chose to release this under the GNU General Public License. This is as simple as including the following in the code.
/*
Copyright 2009 John Gilligan (email : johng@codedeveloper.net)
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 St, Fifth Floor, Boston, MA 02110-1301 USA
*/Upload and View
At this point I uploaded my plugin to the appropriate wordpress directory (/install_path/wp-content/plugins/) and logged into the admin. All went well and I saw this in the plugin section.

Wordpress plugin admin view
That’s all there is to getting a wordpress plugin setup. In the next post we will add some functionality.
css · development · Javascript · jQuery · PHP · plugin · Wordpress · wp
No comments yet.
Leave a Reply
<< WP Plugin Development – Starting the Class and Adding an Admin
