WordPress Plugin Development- Rich Media Institute Workshop - Presentation Transcript
WordPress Plug-in Development Rich Media Institute Brendan Sera-Shriar BackSpaceStudios.com
Extending WordPress
“ Plug-ins can extend WordPress to do almost anything you can imagine.”
-WordPress.org
Well almost! There is a limit to what a plug-in can do. Quite often in order to achieve the desired functionality there is some customization of code required.
WordPress plug-ins help enhance and simplify the blogging experience of advanced users , especially web developers and designers.
Customizing WordPress Plug-ins
Not all plug-ins work out of the box! A good majority of powerful and essential plug-ins will require some customization. This means CODE!
A blogger with basic to expert knowledge of HTML/CSS, and for a lot plugins, PHP and MySQL experience is highly recommended.
A blogger who needs to display complex content in posts and pages like displaying and colorizing code snippets, running custom scripts only on certain posts or pages, incorporating custom web forms, etc.
A blogger who knows what they’re doing - The default configuration of WordPress is too "fool-proof". For example, with the visual editor turned on, it will add unexpected indents and line breaks even inside <pre> tags. Additionally, it blocks you from adding <div> tags, automatically "sanitizing" them into <p> tags.
Tips On Writing WordPress Plug-ins
When all else fails! You don’t have to be a PHP or WordPress expert, anyone can create useful WordPress plug-ins without being a hacker.
Check out the Source of Plug-ins
One of the most helpful ways to improve your coding is by checking out the other plug-ins source code. Each plug-in author has a completely unique style of coding, and this can vary from super-advanced like the Google Sitemap Generator plug-in to the incredibly-simple like the AskApache Search Engine Verify plug-in.
Research with a Purpose
Instead of just picking plug-ins at random to reverse-engineer, surf the WordPress plug-in repository for unique plug-ins that perform a specific function or feature. For example; If you wanted to learn about MySQL search and replace code for WordPress, check out the source code of the excellent Search Regex plugin.
Use a plug-in Template
Any good Web Developer knows the extreme value of using modular, templateable code. CSS, XHTML, javascript, and PHP, all are geared towards templates. WordPress is one of the mack-daddies of templates, so why not use a template for plug-in files?
For each new plug-in I create a folder in the /wp-content/plugins/ pluginname / and then in that folder I create the main plug-in file with the same name as the folder + .php so the plug-in file is /wp-content/plugins/pluginname/ pluginname.php .
I usually start by converting a php function that I have built or found and convert it by adding the necessary WP code.
Main Elements
Header Stuff (Name, version, etc…)
Add Menu Option
Set Up the Options Page
Register the Activation and Deactivation Hooks
The Main Function
*Always make sure to include a readme.txt with your plug-in package.
Let’s build a plug-in
Writing WordPress Plug-ins
We will convert a simple php function that randomly loads Flash files from any local or remote URL.
Lets take a look > http://backspacestudios.com/RMI/flashloader.php
Writing WordPress Plug-ins
randomflashloader.php header stuff
<?php
/*
Plugin Name: RandomFlashLoader
Plugin URI: http://www.backspacestudois.com/
Description: Randomly loads a flash file from your wp-content/plugins/randomflashloader/swf direcotry
FlashPress is an extension to WordPress, which allows Flash designers/developers to use the WordPress engine to communicate with a Flash site. The use of the WordPress CMS in Flash overcomes many obstacles involved with maintaining and updating a Flash site.
The FlashPress development thread is restricted to contributors of this group. If you would like to contribute to this project please contact us at [email_address]
Launching soon http://www.flashpress.ca and http://www.flashpressdevelopers.com
We will be launching FlashPress at FITC Toronto 2009!
FREE PHUG Workshops
Current Scheduled Workshops:
Tiki Wiki
FBML and Facebook Fan Pages
The Power of Twitter
Advertising for the Social Web
Customizing WP2.7 Admin
We would like to thank some of our sponsors and affiliates:
PHUG, Lifecapture Interactive Inc., BackSpaceStudios, Mozilla Firefox, WordPress.org, Drupal.org,
FITC ( Flash In The Can ), RMI ( Rich Media Institute ), TikiWiki, Citadel Rock.
If you would like to present or no someone who does we are still taking applications. Please send us an
email at [email_address]
http://workshops.phug.ca
WordCamp Toronto 2009
Hosted by PHUG
WordCamp is a conference type of event that focuses squarely on everything WordPress. Everyone from casual end users all the way up to core developers show up to these events. These events are usually highlighted by speeches or keynotes by various people.
http://www.wordcamptoronto.com
Other Ways to Stay in Touch PHUG – Open Source Culture http://www.facebook.com/group.php?sid=17f1d77e9310971276dc2fd49210fa18&gid=5470619311 WordCamp Toronto http://www.facebook.com/group.php?gid=50753366566#/group.php?gid=50753366566 PHUG – Open Source Culture http://twitter.com/PHUGCulture WordCamp Toronto http://twitter.com/WordCampTO
“Plug-ins can extend WordPress to do almost anyth more
“Plug-ins can extend WordPress to do almost anything you can imagine.” In this workshop we will cover the following areas, Extending WordPress, Customizing WordPress Plug-ins, Tips On Writing WordPress Plug-ins, Writing WordPress Plug-ins, and Essential WordPress Plug-ins. Plus, that isn’t enough, we will build a simple Flash plug-in by the end of the workshop that you can take with you!" less
0 comments
Post a comment