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

Like this? Share it with your network

Share

Writing Your First WordPress Plugin

  • 4,288 views
Uploaded on

How to write a WordPress plugin.

How to write a WordPress plugin.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
4,288
On Slideshare
4,286
From Embeds
2
Number of Embeds
2

Actions

Shares
Downloads
72
Comments
0
Likes
10

Embeds 2

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

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Writing Your First Plugin by Mark Jaquith @markjaquith markjaquith.com Saturday, August 21, 2010
  • 2. Assumptions • You know PHP syntax • You’re targeting PHP 5 Saturday, August 21, 2010
  • 3. 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
  • 4. 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
  • 5. 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
  • 6. Plugin Header “Plugin Name” is required. Saturday, August 21, 2010
  • 7. Basic Structure • Build some stuff • Tell WordPress to use that stuff when WordPress does certain stuff Saturday, August 21, 2010
  • 8. Actions • Triggered when various things happen in WordPress core • “Wakes up” code you’ve registered against that action Saturday, August 21, 2010
  • 9. Actions Saturday, August 21, 2010
  • 10. Actions Saturday, August 21, 2010
  • 11. Filters • WordPress passes data to your code • Your code optionally changes the data, then returns it to WordPress Saturday, August 21, 2010
  • 12. Filters Saturday, August 21, 2010
  • 13. Filters Saturday, August 21, 2010
  • 14. How to organize your plugin Saturday, August 21, 2010
  • 15. Saturday, August 21, 2010
  • 16. Saturday, August 21, 2010
  • 17. Prefix cws_spn_function_name() Saturday, August 21, 2010
  • 18. Singleton Saturday, August 21, 2010
  • 19. Singleton variation Saturday, August 21, 2010
  • 20. Most Important Action in WordPress init Saturday, August 21, 2010
  • 21. 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
  • 22. Saturday, August 21, 2010
  • 23. Saturday, August 21, 2010
  • 24. Saturday, August 21, 2010
  • 25. Saturday, August 21, 2010
  • 26. Saturday, August 21, 2010
  • 27. Saturday, August 21, 2010
  • 28. Saturday, August 21, 2010
  • 29. Saturday, August 21, 2010
  • 30. Settings form handle Setting name Saturday, August 21, 2010
  • 31. Section handle Title Content callback Settings form handle Saturday, August 21, 2010
  • 32. HTML id Title Content callback Settings form handle Section handle Saturday, August 21, 2010
  • 33. Saturday, August 21, 2010
  • 34. Saturday, August 21, 2010
  • 35. Saturday, August 21, 2010
  • 36. Saturday, August 21, 2010
  • 37. Saturday, August 21, 2010
  • 38. Saturday, August 21, 2010
  • 39. Saturday, August 21, 2010
  • 40. Saturday, August 21, 2010
  • 41. Saturday, August 21, 2010
  • 42. Saturday, August 21, 2010
  • 43. Saturday, August 21, 2010
  • 44. http://txfx.net/s/3q Saturday, August 21, 2010