Writing Your First WordPress Plugin
Upcoming SlideShare
Loading in...5
×
 

Writing Your First WordPress Plugin

on

  • 4,188 views

How to write a WordPress plugin.

How to write a WordPress plugin.

Statistics

Views

Total Views
4,188
Views on SlideShare
4,186
Embed Views
2

Actions

Likes
10
Downloads
72
Comments
0

2 Embeds 2

http://paper.li 1
http://a0.twimg.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Writing Your First WordPress Plugin Writing Your First WordPress Plugin Presentation Transcript

  • Writing Your First Plugin by Mark Jaquith @markjaquith markjaquith.com Saturday, August 21, 2010
  • Assumptions • You know PHP syntax • You’re targeting PHP 5 Saturday, August 21, 2010
  • What I want you to learn • Plugins change what WordPress does • They rely on the concepts of actions and filters • There are numerous internal WordPress APIs for you to use Saturday, August 21, 2010
  • What is a Plugin? • PHP code that sits in separate files • Integrates tightly with WordPress • Can add, alter, or remove functionality Saturday, August 21, 2010
  • Where? • wp-content/plugins/name.php • wp-content/plugins/folder/name.php • WordPress only looks one level deep • It looks for .php files with a plugin header Saturday, August 21, 2010
  • Plugin Header “Plugin Name” is required. Saturday, August 21, 2010
  • Basic Structure • Build some stuff • Tell WordPress to use that stuff when WordPress does certain stuff Saturday, August 21, 2010
  • Actions • Triggered when various things happen in WordPress core • “Wakes up” code you’ve registered against that action Saturday, August 21, 2010
  • Actions Saturday, August 21, 2010
  • Actions Saturday, August 21, 2010
  • Filters • WordPress passes data to your code • Your code optionally changes the data, then returns it to WordPress Saturday, August 21, 2010
  • Filters Saturday, August 21, 2010
  • Filters Saturday, August 21, 2010
  • How to organize your plugin Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Prefix cws_spn_function_name() Saturday, August 21, 2010
  • Singleton Saturday, August 21, 2010
  • Singleton variation Saturday, August 21, 2010
  • Most Important Action in WordPress init Saturday, August 21, 2010
  • Let’s build a plugin! • Insert mailing address and phone number into a post or a page • Use a shortcode... [address] • Configurable address and phone number • Option to show phone number by default (or not) • Ability to override the phone number default Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Settings form handle Setting name Saturday, August 21, 2010
  • Section handle Title Content callback Settings form handle Saturday, August 21, 2010
  • HTML id Title Content callback Settings form handle Section handle Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • Saturday, August 21, 2010
  • http://txfx.net/s/3q Saturday, August 21, 2010