Professional Documents
Culture Documents
Wordpressplugindevelopmentshorttutorial 1226319486417234 8
Wordpressplugindevelopmentshorttutorial 1226319486417234 8
Predevelopmentissues
Wordpress Plugin Directory Plugin andFileNames FileHeaders
Addingdatatowordpress database
Creatingtableswithplugins
AddingAdministrationMenus
Creatingoptionspage
HelloDolly example
11/10/2008 Wordpress Plugin Development AShort Tutorial 2
Predevelopmentissues(1)
Wordpress Plugin Directory
code
javascript
wpcontent
plugins
yourplugin
css
placeyourplugin here
images
11/10/2008
Predevelopmentissues(2)
Plugin andFileNames
Choose your plugins name carefully. Think about whattheplugin willdo,andmakea,hopefullyunique, nameforit.
11/10/2008
Predevelopmentissues(3)
FileHeaders
11/10/2008
Hooks
11/10/2008
Action
11/10/2008 Wordpress Plugin Development AShort Tutorial
Event
7
DATA
Filters are functions that WordPress passes data through at certain points in execution, just before taking some action with the data such as adding it to the database or sending it to the browser screen.
11/10/2008 Wordpress Plugin Development AShort Tutorial 8
AddingdatatoWordpress database
Createtableswithplugins
There are two types of information you could store Setup Information: user choices that are entered when the user first sets up your plugin. Data: information that is added as the user continues to use your plugin Steps 1. Write a PHP function that creates the table. 2. Ensure that WordPress calls the function when the plugin is activated. 3. Create an upgrade function, if a new version of your plugin needs to have a different table structure.
http://codex.wordpress.org/Creating_Tables_with_Plugins#Create_Database_Tables
11/10/2008 Wordpress Plugin Development AShort Tutorial 9
Asimpleexample
$table_name = $wpdb->prefix . "liveshoutbox";
// SQL Statement
$sql = "CREATE TABLE " . $table_name . " ( id mediumint(9) NOT NULL AUTO_INCREMENT, time bigint(11) DEFAULT '0' NOT NULL, name tinytext NOT NULL, text text NOT NULL, url VARCHAR(55) NOT NULL, UNIQUE KEY id (id) );";
Asimpleexample
$welcome_name = "Mr. Wordpress"; $welcome_text = "Congratulations, you just completed the installation!";
// SQL Statememt
$insert = "INSERT INTO " . $table_name . " (time, name, text) " . "VALUES ('" . time() . "','" . $wpdb->escape($welcome_name) . "','" . $wpdb->escape($welcome_text) . "')";
AddingAdministrationMenus
Createoptionspage
Top-level menus: Settings, Manage, Plugins, Presentation, Write, Users
Admin Menu Functions add_menu_page: create a top-level menu add_submenu_page: define one or more sub-menu pages In the above wordpress functions the developers defined the name of their php functions which are responsible to build the options pages. See an example here http://codex.wordpress.org/Creating_Options_Pages
11/10/2008
12
HelloDollyexample
Chose randomly one lyric and place it the upper right of your Administation panels
add_action('admin_footer', 'hello_dolly');
11/10/2008
13
Wordpress DevelopmentCommunity
Are you ready to enter into an evolving development community?
11/10/2008
14
MattMullenweg
Creator of Wordpress.org
14th place
The 25 most influential people on the web (2008)
11/10/2008
15
Moredetailsontheinternet
The truth is out there
http://codex.wordpress.org/Writing_a_Plugin#WordPress_Plugin_Hooks http://codex.wordpress.org/Plugin_API http://codex.wordpress.org/Creating_Tables_with_Plugins http://codex.wordpress.org/Adding_Administration_Menus
11/10/2008
16
THEEND
Thankyou!
11/10/2008 Wordpress Plugin Development AShort Tutorial 17