Extending WordPress beyond!

2,720 views

Published on

Published in: Technology
1 Comment
2 Likes
Statistics
Notes
No Downloads
Views
Total views
2,720
On SlideShare
0
From Embeds
0
Number of Embeds
70
Actions
Shares
0
Downloads
17
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide

Extending WordPress beyond!

  1. 1. CC-BY-NC flickr.com/photos/28634332@N05/ExtendingWordPressbeyond! mitcho (Michael 貴 Erlewine) http://mitcho.com, @themitchoD.C. WordPress Meetup, March 18, 2011
  2. 2. follow slides onhttp://slideshare.net/mitcho
  3. 3. Today: extend WordPress...
  4. 4. Today: extend WordPress... beyond the blog
  5. 5. Today: extend WordPress... beyond the blog beyond the hack
  6. 6. Today: extend WordPress... beyond the blog beyond the hack beyond your site
  7. 7. Introduction
  8. 8. Introduction• Hi, I’m mitcho.
  9. 9. Introduction• Hi, I’m mitcho. • Linguist, coder, teacher.
  10. 10. Introduction• Hi, I’m mitcho. • Linguist, coder, teacher.• http://mitcho.com; @themitcho
  11. 11. Introduction• Hi, I’m mitcho. • Linguist, coder, teacher.• http://mitcho.com; @themitcho• Linguistics PhD student at MIT
  12. 12. Introduction• Hi, I’m mitcho. • Linguist, coder, teacher.• http://mitcho.com; @themitcho• Linguistics PhD student at MIT• Mozilla, Automattic, MIT
  13. 13. Yet Another RelatedPosts Plugin (YARPP)
  14. 14. Yet Another RelatedPosts Plugin (YARPP)• smart “related posts” listings with lots of customization
  15. 15. Yet Another RelatedPosts Plugin (YARPP)• smart “related posts” listings with lots of customization• mitcho.com/code/yarpp or search for “YARPP”; @yarpp
  16. 16. Yet Another RelatedPosts Plugin (YARPP)• smart “related posts” listings with lots of customization• mitcho.com/code/yarpp or search for “YARPP”; @yarpp• over 850k downloads
  17. 17. HookPress
  18. 18. HookPress• opens up the WordPress hook system to remote scripts
  19. 19. HookPress• opens up the WordPress hook system to remote scripts• extend WP with other languages
  20. 20. HookPress• opens up the WordPress hook system to remote scripts• extend WP with other languages• now on WordPress.com!
  21. 21. HookPress• opens up the WordPress hook system to remote scripts• extend WP with other languages• now on WordPress.com!• mitcho.com/code/hookpress; @hookpress
  22. 22. ShrimpTest
  23. 23. ShrimpTest• A/B testing, built right into WP
  24. 24. ShrimpTest• A/B testing, built right into WP• joint project with Automattic
  25. 25. ShrimpTest• A/B testing, built right into WP• joint project with Automattic• currently in perpetual beta:
  26. 26. ShrimpTest• A/B testing, built right into WP• joint project with Automattic• currently in perpetual beta: • shrimptest.com; @shrimptest
  27. 27. ShrimpTest• A/B testing, built right into WP• joint project with Automattic• currently in perpetual beta: • shrimptest.com; @shrimptest• video of talk up on wordpress.tv
  28. 28. CC-BY-NC-SA flickr.com/photos/13382424@N00/5216424459/
  29. 29. WordPress at MIT
  30. 30. WordPress at MIT• Becoming the platform of choice
  31. 31. WordPress at MIT• Becoming the platform of choice• Free, flexible, easy, well-known
  32. 32. WordPress at MIT• Becoming the platform of choice• Free, flexible, easy, well-known• Academic to administrative; public and private
  33. 33. WordPress at MIT• Becoming the platform of choice• Free, flexible, easy, well-known• Academic to administrative; public and private• But... is it more than just a blog?
  34. 34. take WordPressbeyond the blog
  35. 35. three examples from MIT
  36. 36. Edgerton Digital CollectionsMIT Museum and MIT Edgerton Centerhttp://edgerton-digital-collections.org
  37. 37. 12000 photos, 8000 notebook pages Dynamic custom UI and search
  38. 38. Transcriptions and commentsMetadata direct from museum data store
  39. 39. Global Shakespeares MIT Shakespeare Projecthttp://globalshakespeares.org
  40. 40. Rich custom metadataAll managed through WordPress
  41. 41. Dynamic search Calls WordPress search via AJAXDOM built client-side; data in localstorage
  42. 42. Educational Collaboration Space MIT Dept. of Mathematics, NSF more info at http://ecs.mit.edu
  43. 43. Management of “File Groups”Content linked through tags Notification by tags
  44. 44. WP beyond blogs?
  45. 45. WP beyond blogs?• A solid foundation
  46. 46. WP beyond blogs?• A solid foundation • Faster development cycle
  47. 47. WP beyond blogs?• A solid foundation • Faster development cycle• Cohesive structure and navigation
  48. 48. WP beyond blogs?• A solid foundation • Faster development cycle• Cohesive structure and navigation• A great community
  49. 49. WP beyond blogs?• A solid foundation • Faster development cycle• Cohesive structure and navigation• A great community • Plugins and themes you can use
  50. 50. CONTENTCC-BY-NC-SA flickr.com/photos/bikeracer/6740232/
  51. 51. Details, details, details
  52. 52. Details, details, details• Navigation, permalinks, RSS
  53. 53. Details, details, details• Navigation, permalinks, RSS• User roles and permissions
  54. 54. Details, details, details• Navigation, permalinks, RSS• User roles and permissions• External data? AJAX-heavy UI?
  55. 55. Details, details, details• Navigation, permalinks, RSS• User roles and permissions• External data? AJAX-heavy UI? • Ask me about it. :)
  56. 56. take WordPressbeyond the blog
  57. 57. You customized WordPress for a project.
  58. 58. what if...
  59. 59. CC-BY-NC-SA flickr.com/photos/slworking/1704538333
  60. 60. • they move servers... CC-BY-NC-SA flickr.com/photos/slworking/1704538333
  61. 61. • they move servers...• they want to reuse some of it... CC-BY-NC-SA flickr.com/photos/slworking/1704538333
  62. 62. • they move servers...• they want to reuse some of it...• they want modifications... CC-BY-NC-SA flickr.com/photos/slworking/1704538333
  63. 63. • they move servers...• they want to reuse er ! as t some of it...d i s• they want modifications... CC-BY-NC-SA flickr.com/photos/slworking/1704538333
  64. 64. take your codebeyond the hack
  65. 65. Abstraction!
  66. 66. Abstraction arises from therecognition of similarities betweencertain objects, situations, orprocesses in the real world and thedecision to concentrate on thesesimilarities and to ignore, for thetime being, their differences. — C.A.R. Hoare
  67. 67. Abstraction
  68. 68. Abstraction = thinking about themore general problem
  69. 69. result =
  70. 70. result =code that you and others can reuse
  71. 71. How?
  72. 72. Think abstractly
  73. 73. Think abstractly• Produce “functionalities”
  74. 74. Think abstractly• Produce “functionalities”• One functionality = one plugin
  75. 75. Think abstractly• Produce “functionalities”• One functionality = one plugin• Interrelated code can be modularized
  76. 76. Think abstractly• Produce “functionalities”• One functionality = one plugin• Interrelated code can be modularized • introduce new hooks and filters with do_action(), apply_filters()
  77. 77. Use WP abstractions
  78. 78. Use WP abstractions• DB query? $wpdb, not mysql_*
  79. 79. Use WP abstractions• DB query? $wpdb, not mysql_*• Caching? Object Cache and Transients API
  80. 80. Use WP abstractions• DB query? $wpdb, not mysql_*• Caching? Object Cache and Transients API• Options? set_option() not db
  81. 81. Use WP abstractions
  82. 82. Use WP abstractions• Posts? get_posts() not SQL
  83. 83. Use WP abstractions• Posts? get_posts() not SQL• Custom data? Custom taxonomy or fields
  84. 84. Use WP abstractions• Posts? get_posts() not SQL• Custom data? Custom taxonomy or fields• New entities? Custom post types!
  85. 85. Use WP abstractions• Posts? get_posts() not SQL• Custom data? Custom taxonomy or fields• New entities? Custom post types!• External request? wp_remote_post() not curl
  86. 86. Don’t reinvent the wheel. © 2008 Drew and Natalie Dee, toothpastefordinner.com
  87. 87. Be mobile
  88. 88. Be mobile• Don’t expect to be in a particular place
  89. 89. Be mobile• Don’t expect to be in a particular place• Use __FILE__, plugins_url(), etc.
  90. 90. Be mobile• Don’t expect to be in a particular place• Use __FILE__, plugins_url(), etc.• Get info with get_bloginfo()
  91. 91. Be mobile• Don’t expect to be in a particular place• Use __FILE__, plugins_url(), etc.• Get info with get_bloginfo()• Use $wpdb so you can forget about database settings
  92. 92. Be classy
  93. 93. Be classy• OOP is perfect for abstracting “functionality”
  94. 94. Be classy• OOP is perfect for abstracting “functionality”• Write your functionality as a class with some defaults
  95. 95. Be classy• OOP is perfect for abstracting “functionality”• Write your functionality as a class with some defaults• Easy for others to extend
  96. 96. Be classy• OOP is perfect for abstracting “functionality”• Write your functionality as a class with some defaults• Easy for others to extend• Clean, legible code
  97. 97. Give yourself options
  98. 98. Give yourself options• Don’t hard code the project name, URLs, emails, etc.
  99. 99. Give yourself options• Don’t hard code the project name, URLs, emails, etc.• Bare minimum: declare as overrideable constants
  100. 100. Give yourself options• Don’t hard code the project name, URLs, emails, etc.• Bare minimum: declare as overrideable constants• Ideally: create an options screen
  101. 101. Learn from the masters
  102. 102. Learn from the masters• http://codex.wordpress.org
  103. 103. Learn from the masters• http://codex.wordpress.org• Read others’ code.
  104. 104. Learn from the masters• http://codex.wordpress.org• Read others’ code. • Borrow and adapt from other plugins, themes, and the Core
  105. 105. Learn from the masters• http://codex.wordpress.org• Read others’ code. • Borrow and adapt from other plugins, themes, and the Core • “free as in freedom!”
  106. 106. Good practice matters CC-BY-NC xkcd.com/292/
  107. 107. Results
  108. 108. Results• Won’t [Less likely to] break when you move or upgrade
  109. 109. Results• Won’t [Less likely to] break when you move or upgrade• Easier to maintain
  110. 110. Results• Won’t [Less likely to] break when you move or upgrade• Easier to maintain• Easier to build on
  111. 111. Results• Won’t [Less likely to] break when you move or upgrade• Easier to maintain• Easier to build on• Easier to reuse elsewhere
  112. 112. take your codebeyond the hack
  113. 113. but wait, there’s more...
  114. 114. CC-BY-NC-SA flickr.com/photos/z6p6tist6/500048151/
  115. 115. Free software is not a one way street. CC-BY-NC-SA flickr.com/photos/z6p6tist6/500048151/
  116. 116. WordPress is not a one way street.CC-BY-NC-SA flickr.com/photos/z6p6tist6/500048151/
  117. 117. Think:
  118. 118. Think:• You just customized WordPress for a client
  119. 119. Think:• You just customized WordPress for a client• Others could benefit from this
  120. 120. Think:• You just customized WordPress for a client• Others could benefit from this• You and the client have benefited from free software: WordPress
  121. 121. Consider open-sourcing your client-requested functionality.
  122. 122. take your codebeyond your site
  123. 123. Do people really do this?
  124. 124. success stories:
  125. 125. success stories: My own work at MIT
  126. 126. Open source from MIT
  127. 127. Open source from MIT• Shakespeare: Redirect by Custom Field, Require First and Last Name
  128. 128. Open source from MIT• Shakespeare: Redirect by Custom Field, Require First and Last Name• Educational Collaboration Space: File Groups, Distinct Preview, Allow LaTeX Uploads, Notifications By Tag, License
  129. 129. LicenseEducational Collaboration Space
  130. 130. LicenseEducational Collaboration Space
  131. 131. ECS and Shibboleth
  132. 132. ECS and Shibboleth • Shibboleth authentication
  133. 133. ECS and Shibboleth • Shibboleth authentication • now contributing to the pre- existing Shibboleth plugin
  134. 134. ECS and Shibboleth • Shibboleth authentication • now contributing to the pre- existing Shibboleth plugin • MIT customizations can be reused in other MIT projects
  135. 135. success stories: Brad Williams co-founder, WebDevStudios.com
  136. 136. Brad Williams
  137. 137. Brad Williams• NextGEN Public Uploader
  138. 138. Brad Williams• NextGEN Public Uploader• Post Google Map
  139. 139. Brad Williams• NextGEN Public Uploader• Post Google Map • sponsored by injersey.com
  140. 140. Brad Williams
  141. 141. Brad Williams• no client has said no
  142. 142. Brad Williams• no client has said no• many clients want to give back
  143. 143. Brad Williams• no client has said no• many clients want to give back• plugins have brought in new clients
  144. 144. success stories: John James Jacoby John James Jacoby BuddyPressConsulting and Custom Development
  145. 145. BuddyPress Member Filterdevelopment supported by LOGOI Ministries
  146. 146. BuddyPress Edit Group Slugdevelopment supported by We Heart This
  147. 147. John James Jacoby
  148. 148. John James Jacoby• educate client about community role and open-source
  149. 149. John James Jacoby• educate client about community role and open-source• sometimes appropriate to just open-source the backend w/o UI
  150. 150. John James Jacoby• educate client about community role and open-source• sometimes appropriate to just open-source the backend w/o UI• community contributions got him noticed
  151. 151. John James Jacoby• educate client about community role and open-source• sometimes appropriate to just open-source the backend w/o UI• community contributions got him noticed • BuddyPress Core contributor
  152. 152. Tips
  153. 153. Tips• bring up open-sourcing early
  154. 154. Tips• bring up open-sourcing early• if they say no, respect that
  155. 155. Tips• bring up open-sourcing early• if they say no, respect that• don’t pass cost back to client
  156. 156. Tips• bring up open-sourcing early• if they say no, respect that• don’t pass cost back to client• acknowledge the funding
  157. 157. Tips• bring up open-sourcing early• if they say no, respect that• don’t pass cost back to client• acknowledge the funding• don’t forget you can contribute to existing projects as well
  158. 158. take your codebeyond your site
  159. 159. Today: extend WordPress...
  160. 160. Today: extend WordPress... beyond the blog
  161. 161. Today: extend WordPress... beyond the blog beyond the hack
  162. 162. Today: extend WordPress... beyond the blog beyond the hack beyond your site
  163. 163. Thank you!Questions?Slides up on slideshare.net/mitcho.mitcho (Michael 貴 Erlewine)mitcho.com; @themitcho

×