Wordcamp2012 build your plugin

1,260 views

Published on

My presentation at WordCamp

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,260
On SlideShare
0
From Embeds
0
Number of Embeds
55
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Wordcamp2012 build your plugin

  1. 1. Build your own Plugin
  2. 2. Build your own WordPress Plugin Speaker Alexandre Marreiros Tech Trainner and Speaker and Consultnat as Independent CTO Innovagency Contacts @alexmarreiros | amarreiros@gmail.com digitalmindignition.com
  3. 3. Build your own WordPress Plugin Plugin “Plug-ins are a great way to enhance the functionality of your blog or WebSite by adding in extra features. These can be placed anywhere inside your template by function hooks. Over time the extensibility of WordPress’ plug-in system has allow tremendous growth and hundreds of developer-submitted pieces of software.”
  4. 4. Build your own WordPress Plugin What i need to build plugin’s Knowledge of PHP (Rudimentar) Basic understanding of the WordPress file structure Good Ideias or problems
  5. 5. Build your own WordPress Plugin Why Build Plugin’s When you need to solve a recorrent WordPress development need When you need to extende the plataform To a better understaning of the WordPress Backend
  6. 6. Build your own WordPress Plugin Where Plugin’s Live?
  7. 7. Build your own WordPress Plugin Best Pratice 1 Give a “Home” to your Plugin this way you simplify Plugin file system struture Create a readme.txt file to explain who are the person who knows how the Plugin is built
  8. 8. Build your own WordPress Plugin To Start Create the base PHP file for your Plugin You must start with the plugin declaration
  9. 9. Build your own WordPress Plugin 2 Build Aproaches Create an entire class system to avoid collisions with functions and variable names that already exist. just write your code in sample functions.
  10. 10. Build your own WordPress Plugin Best Pratice 2 Don’t do Suicide if your plugin is simple don’t start building a entire new class ecosystem for him.
  11. 11. Build your own WordPress Plugin Best Pratice 3 To avoid duplication use prefixing labels to all your variables and function names.
  12. 12. Build your own WordPress Plugin Actions and Filters “Actions and Filters allow for plug-in developers to update bits of code throughout the WordPress admin panel pertaining to your new plug-in. This means you could add a new tab in the sidebar or additional settings links for your Plug-in options.”
  13. 13. Build your own WordPress Plugin Filter A filter is used on data being passed into WordPress. With filters you are quite literally able to filter content through your own custom written functions to change data in any way. Used in cases like writing a sidebar widgets or smaller functions to change how a post should be displayed.
  14. 14. Build your own WordPress Plugin Actions Target pre-defined areas in your templates and admin panel. Is important if your Plugin intend to be triggered when something happens in your WordPress event Pipeline. publish_post – called when a post is published or when status is changed into “published” save_post – called when a post/page is created from start or updated wp_head – called when the template is loaded and runs the wp_head() function loop_end – called immediately after the final post has been processed through the WordPress loop trackback_post – called whenever a new trackback is added into a post
  15. 15. Build your own WordPress Plugin Plugin Registering Plugin Creates Register Plugin is his Hooks in functions as a installed WP Action Listener Plugin is Register “hooked” to functions as a WordPress Filter Listen
  16. 16. Build your own WordPress Plugin When Plugin is Called Wordpress Wordpress executes an Validates all the action or render s register functions Call Plugins functions (considering registering order)
  17. 17. Build your own WordPress Plugin Best Pratice 4 Be carefull not to destruct what plugin’s that came before you had made.
  18. 18. Build your own WordPress Plugin Demo
  19. 19. Build your own WordPress Plugin Questions  Your turn to Talk Resources  http://codex.wordpress.org/Writing_a_Plugin  Professional WordPress Plugin Development by Brad Williams, Ozh Richard and Justin Tadlock  WordPress 3 Plugin Development Essentials by B Bondari and E Griffiths (24 Mar 2011)

×