WordPress plugin is an addon for WordPress blogs to add new features to the blog. There are tons of WordPress extensions available at the WordPress extension directory. I recently wrote a twitter extension for WordPress which is available for public download here.
If you are planing to write your own WordPress extension, you can do it if you have knowledge of PHP and if you are aware of the WordPress functionality.
For writing a WordPress plugin you need to first create a file with the following code on top part of the file. You need to maintain the coding style of the WordPress plugin as per the WordPress Documentation
<?php
/*Plugin Name: Name Of The PluginPlugin URI: http://URI_Of_Page_Describing_Plugin_and_UpdatesDescription: A brief description of the plugin.Version: The plugin's Version Number, e.g.: 1.0Author: Name Of The Plugin AuthorAuthor URI: http://URI_Of_The_Plugin_Author*/?>
The licence part of a WordPress plugin
<?php
/* Copyright YEAR PLUGIN_AUTHOR_NAME (email : PLUGIN AUTHOR EMAIL) 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*/?>
The above two codes are the standard for WordPress plugins and you need to follow that
Then comes the programing part of the wordpress. I show a simple function which prints some text
<?php
function myFirstPlugin($mycontent) {return str_replace("kishore", "<a href = \"http://kish.in\">Kishore</a>");
}
?>
<?php add_filter('the_content','myFirstPlugin'); ?>
Your first plugin is ready for testing.
What does this plugin do?
I have created a function which replaces the text, “Kishore” with a link to my blog. I have used the filter “the_content” which replaces the text of the content of post.
- WordPress 2.5, automatic plugin upgrade demo : I upgraded this blog to wordpress...
- WordPress plugin for Twitter : I have written a WordPress plugin...
- AJAX Twitter plugin for WordPress : I have been working on a...
- Database backup plugin for WordPress : Creating a backup of the database ...
- AJAX Twitter plugin for WordPress : I have been working on a...
Tweet Samsung Galaxy Note Rom is available for download, but this is only for AT&T users (This ...
Tweet I am currently using a Samsung Galaxy Note and I was using an iPhone 4 and an iPad 2 along wit...
Pingback: Checklist for submitting your plugin to Wordpress Extension Directory | Technology Blog