Writing a WordPress Plugin: #heweb12
-
Upload
curtiss-grymala -
Category
Education
-
view
662 -
download
4
description
Transcript of Writing a WordPress Plugin: #heweb12
WRIT
ING A
WORDPR
ESS
PLUGIN
GETTING STARTED
• Create a blank PHP file• Add the plugin header - http://j.mp/TgCGXP
• Plan your plugin• What should it do?• What features/options should it have?
• Create another blank PHP file• Open and close a new PHP class
BUILD T
HE BASE
BE
GI N
CR
EA
TI N
G T
HE
BA
SI C
FU
NC
TI O
NA
L I TY
CREATE A SHORTCODE
• Implement a new shortcode
• Implement the base functionality
• Register the new shortcode• http://codex.wordpress.org/Function_Reference/add_shortcode
Instantiate the plugin class
TRY
IT O
UT
ADD SOME OPTIONS
• Register new admin page• http://codex.wordpress.org/Function_Reference/add_submenu_page
• Create options page
• Register/whitelist settings section, settings fields• http://codex.wordpress.org/Function_Reference/add_settings_section• http://codex.wordpress.org/Function_Reference/add_settings_field
• Sanitize your settings
TRY
IT O
UT
MAKE A WIDGET
• Another blank PHP file
• Open a class that extends WP_Widget
• Create the four required functions• http://codex.wordpress.org/Widgets_API#Developing_Widgets
TRY
IT O
UT
OTHER RESOURCES/FUNCTIONS
• plugins_url – automatically build the URL to a specific file
• plugin_dir_path – automatically retrieve absolute path to directory
• WPDB Class – access and manipulate the WordPress database
• WP_HTTP Class – retrieve Web resources without depending on cURL
• Transients API – store cache information with explicit expiration times
RESOURCES
• The WordPress Codex• Plugin API - http://codex.wordpress.org/Plugin_API/• Settings API - http://codex.wordpress.org/Settings_API• Function Reference - http://
codex.wordpress.org/Function_Reference• Professional WordPress Plugin Development - http://
j.mp/MxjUfG• WordPress Plugin Developer Center - http://j.mp/MxkDNR• Subversion Utilities
• TortoiseSVN (Windows) - http://tortoisesvn.net/• SVNX (MacOS) - http://code.google.com/p/svnx/• RabbitVCS (Linux) - http://rabbitvcs.org/
QUESTIONS? COMMENTS?
Twitter: @cgrymalaWebsite(s): http://umw.edu/ (Multi-Network Setup)
http://ten-321.com/http://svn.ten-321.com/ (SVN
Repo)Email: [email protected]
[email protected]: http://spkr8.com/s/10608
http://about.me/cgrymala