WordCamp Victoria 2013: Plugin Development 2013
-
Upload
joey-kudish -
Category
Technology
-
view
695 -
download
0
description
Transcript of WordCamp Victoria 2013: Plugin Development 2013
![Page 1: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/1.jpg)
Plugin Development
- Joey Kudish
http://slides.jkudish.comFriday, 11 January, 13
![Page 2: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/2.jpg)
About me
• WordPress developer since 2007
• Initially built sites for a variety of clients
• Freelance plugin development
• Code Wrangler at WordPress.com / Automattic
since May 2011
• Originally from Montreal, moved to Vancouver
in 2011
Friday, 11 January, 13
![Page 3: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/3.jpg)
Friday, 11 January, 13
![Page 4: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/4.jpg)
What’s a plugin?
Friday, 11 January, 13
![Page 5: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/5.jpg)
A plugin extends or modi!es WordPress to do something it
didn’t previously do
Friday, 11 January, 13
![Page 6: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/6.jpg)
Themes can act as plugins. Oh and there’s
mu-plugins too.
Friday, 11 January, 13
![Page 7: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/7.jpg)
Plugins can be huge...
Friday, 11 January, 13
![Page 8: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/8.jpg)
... or tiny.Friday, 11 January, 13
![Page 9: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/9.jpg)
What’s in a plugin?
Friday, 11 January, 13
![Page 10: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/10.jpg)
Where does it go?
wp-content/plugins/[plugin_name]or wp-content/mu-plugins/
Friday, 11 January, 13
![Page 11: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/11.jpg)
In order to “hook” into WordPress, we use action and !lter
hooks
Friday, 11 January, 13
![Page 12: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/12.jpg)
Action hooks allow you to add your own code to WordPress’
call stack
Friday, 11 January, 13
![Page 13: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/13.jpg)
Filter hooks allow you to modify an
existing variable or piece of information
Friday, 11 January, 13
![Page 14: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/14.jpg)
Demo time
Friday, 11 January, 13
![Page 15: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/15.jpg)
Let’s add Google Webmaster Tools
veri!cation to our site
Friday, 11 January, 13
![Page 16: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/16.jpg)
Friday, 11 January, 13
![Page 17: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/17.jpg)
Friday, 11 January, 13
![Page 18: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/18.jpg)
Friday, 11 January, 13
![Page 19: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/19.jpg)
Finding hooks• WordPress.org Codex (http://
codex.wordpress.org/)
• http://adambrown.info/p/wp_hooks
• Debug Bar + Debug Bar Action Hooks plugin
(http://wordpress.org/extend/plugins/debug-bar-
action-hooks/)
• Search core (use your IDE or a command line
tool like ack)
Friday, 11 January, 13
![Page 20: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/20.jpg)
Some pro tips
Friday, 11 January, 13
![Page 21: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/21.jpg)
Use built-in APIs, don’t re-invent the
wheel
Friday, 11 January, 13
![Page 22: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/22.jpg)
Use WordPress coding standards
Friday, 11 January, 13
![Page 23: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/23.jpg)
Be nice to other devs. Namespace your classes
and functions. Leave hooks for others.
Friday, 11 January, 13
![Page 24: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/24.jpg)
Demo time
Friday, 11 January, 13
![Page 25: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/25.jpg)
Friday, 11 January, 13
![Page 26: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/26.jpg)
Friday, 11 January, 13
![Page 27: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/27.jpg)
Friday, 11 January, 13
![Page 28: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/28.jpg)
Friday, 11 January, 13
![Page 29: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/29.jpg)
hey that’s the !le we want to hook into
Friday, 11 January, 13
![Page 30: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/30.jpg)
Friday, 11 January, 13
![Page 31: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/31.jpg)
Friday, 11 January, 13
![Page 32: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/32.jpg)
Friday, 11 January, 13
![Page 33: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/33.jpg)
Friday, 11 January, 13
![Page 34: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/34.jpg)
Let’s create our plugin
Friday, 11 January, 13
![Page 35: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/35.jpg)
Friday, 11 January, 13
![Page 36: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/36.jpg)
Friday, 11 January, 13
![Page 37: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/37.jpg)
Friday, 11 January, 13
![Page 38: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/38.jpg)
Friday, 11 January, 13
![Page 39: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/39.jpg)
Friday, 11 January, 13
![Page 40: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/40.jpg)
Friday, 11 January, 13
![Page 41: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/41.jpg)
Friday, 11 January, 13
![Page 42: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/42.jpg)
Friday, 11 January, 13
![Page 43: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/43.jpg)
It works, now let’s have some fun
Friday, 11 January, 13
![Page 44: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/44.jpg)
Friday, 11 January, 13
![Page 45: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/45.jpg)
Friday, 11 January, 13
![Page 46: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/46.jpg)
Friday, 11 January, 13
![Page 47: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/47.jpg)
Friday, 11 January, 13
![Page 48: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/48.jpg)
Finished plugin
Friday, 11 January, 13
![Page 49: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/49.jpg)
A word on Security
Friday, 11 January, 13
![Page 50: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/50.jpg)
don’t trust users
Friday, 11 January, 13
![Page 51: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/51.jpg)
sanitize input, escape output
http://codex.wordpress.org/Data_Validation
Friday, 11 January, 13
![Page 52: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/52.jpg)
protect users from malicious attacks,
use nonces to validate user actions
http://codex.wordpress.org/WordPress_Nonces
Friday, 11 January, 13
![Page 53: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/53.jpg)
Plugin Distribution
Friday, 11 January, 13
![Page 54: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/54.jpg)
Friday, 11 January, 13
![Page 55: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/55.jpg)
Friday, 11 January, 13
![Page 56: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/56.jpg)
Friday, 11 January, 13
![Page 57: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/57.jpg)
Further reading
Friday, 11 January, 13
![Page 58: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/58.jpg)
Friday, 11 January, 13
![Page 59: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/59.jpg)
Friday, 11 January, 13
![Page 60: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/60.jpg)
Friday, 11 January, 13
![Page 61: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/61.jpg)
http://www.wrox.com/WileyCDA/WroxTitle/Professional-WordPress-Plugin-Development.productCd-0470916222.html
http://www.packtpub.com/wordpress-plugin-development-cookbook/book
Friday, 11 January, 13
![Page 62: WordCamp Victoria 2013: Plugin Development 2013](https://reader034.fdocuments.us/reader034/viewer/2022042700/5552154fb4c905852b8b5391/html5/thumbnails/62.jpg)
Thanks!
Q&Ahttp://slides.jkudish.com
Friday, 11 January, 13