This pages is written while I’m getting know about the WP Plugin development. I have no intention for this to become a tutorial of how to get started. This is a of collection usefull links to articels and videos I used to get the started with developing WP Plugins.

If you are like me, famliar with PHP programming and in general experienced WP user and no Plug In developer you might start with looking at this video. It shows how easy it is and how little it takes to write a simple plug in. Ofcourse this doesn’t give the full picture. But I found it a good inspiration to go deeper into development of WP PlugIn.

Video Links:

 

It always a good idea to get hold of the owners doumentation in the area:

  • http://codex.wordpress.org/Plugin_API. This link point to the Plugin API documentation. The first page describes the “Hooks”, “Actions” and “Filters”. Take a look at the introduction of the terms “Hooks”, “Actions” and “Filters”.

Hooks, Actions and Filters

Hooks are provided by WordPress to allow your plugin to ‘hook into’ the rest of WordPress; that is, to call functions in your plugin at specific times, and thereby set your plugin in motion.  There are two kinds of hooks:

 

  1. Actions: Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more of its PHP functions are executed at these points, using the Action API.
  2. Filters: Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. Your plugin can specify that one or more of its PHP functions is executed to modify specific types of text at these times, using the Filter API.

 

WP HOOKS Reference:

Action Hooks: http://codex.wordpress.org/Plugin_API/Action_Reference

Filter Hooks: http://codex.wordpress.org/Plugin_API/Filter_Reference

WP Globals Reference:

http://codex.wordpress.org/Global_Variables

(General Settings, Browser Detection Booleans, Web Server Detection, Logged in User Data, Inside the Loop variables)

 

Use of Existing Libraries

How to use scripts and styles already linked into WP (e.g. jquery). Do this in order to avoid collision in thirdpart compenents of your WP Plugin and the ones already included in WordPress

wp_enqueue_script(). wp_enqueue_style()

Register your Scripts and Styles

There are also functions to register your Styles and Scripts

wp_register_style(), wp_register_script()

These methods are likely to be used with the action hook “admin_head” for a view in the admin panel or “wp_head” in regular requests.

Interfacing with the database in WordPress

For that task WP have a class called WPDB. Through this you can run almost any queries towords the data. To get more information on this class please go to : http://codex.wordpress.org/Function_Reference/wpdb_Class

If you use this class you wont have to worry about connection string or any other db related challenges but the query itself. This supports Select, Insert and Updates of rows and fields.

The class also handle chache of results. Chache alogorithms can be very triggy and I’m not quit sure how it works in this case.

The class extracts meta information on columns and tables.

$wpdb is a global object that is instanciated your plugin is called. The following note is from the reference manual itself:

Methods in the wpdb class should not be called directly.  WordPress provides a global variable $wpdb, which is an instantiation of the class already set up to talk to the WordPress database

Here is an example of use:

$myrows = $wpdb->get_results( “SELECT id, name FROM mytable” );