WordPress Plugin Development


Published on

Published in: Technology, Business
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

WordPress Plugin Development

  1. 1. Building WordPress pluginsMario Peshevhttp://devwp.euDevriX
  2. 2. Mario Peshev1. WordPress Engineer @ Placester2. DevirX CTO3. @no_fear_inc4. Java/PHP/Python background
  3. 3. Contents1. What is a WordPress plugin?2. Prerequisites3. Start it Smart4. Conventions
  4. 4. What is WordPress plugin?1. A separate module2. Hooked to the WordPress core3. Providing extra functionality A WordPress Plugin is a program, or a set of one or more functions, written in the PHP scripting language, that adds a specific set of features or services to the WordPress weblog, which can be seamlessly integrated with the weblog using access points and methods provided by the WordPress Plugin Application Program Interface (API).
  5. 5. Existing Plugins1. WPORG repository
  6. 6. WordPress APIsand components
  7. 7. APIs and Components1. Shortcode API2. Widgets API3. Menus4. Plugin API (hooks)
  8. 8. APIs and Components (2)1. HTTP API2. Options API3. Settings API4. Transients API5. Rewrite API
  9. 9. Post Management1. Custom Post Types2. Custom Taxonomies3. Custom Fields4. Meta boxes5. Page templates
  10. 10. i18n1. What is I18n?  I18n is a abbreviation for internationalization, or the process of making an application ready for translation.2. load_plugin_textdomain3. __()4. _e()5. _x, _n ...
  11. 11. Database1. WP_Query2. get_posts3. $wpdb4. pre_get_posts hook5. posts_where hook
  12. 12. Scripts and Styles1. wp_enqueue_script2. wp_enqueue_style3. admin_enqueue_scripts hook4. wp_enqueue_scripts hook * A safe way to add/enqueue a CSS/JS files to the WordPress generated page
  13. 13. WordPress Coding Standarshttp://codex.wordpress.org/WordPress_Coding_ Standards
  14. 14. Top plugins1. Jetpack2. WordPress SEO by Yoast3. Contact form 74. W3 Total Cache5. WooCommerce6. Yet Another Related Posts Plugin
  15. 15. Top paid plugins1. Gravity Forms2. WPML3. Toolset4. BackupBuddy5. UberMenu6. …and more
  16. 16. How to create a plugin?
  17. 17. How to create a plugin?1. What my plugin will do?2. Make a plan3. Follow plugin development recommendations.4. Lets do some coding
  18. 18. Lets create a slider plugin
  19. 19. Step 11. Create a folder in wp-content/plugins2. Create a new .php file in there3. Add this on the top of the file:
  20. 20. Step 21. Go to Admin Dashboard and activate the plugin
  21. 21. Step 31. Create a slide custom post type
  22. 22. Step 41. Slider taxonomy
  23. 23. Step 51. Add Options Page  Create dx-lite-slide-options.php file
  24. 24. Step 61. dx-lite-slide-options.php
  25. 25. DX Lite Slide Options Page
  26. 26. Step 71. Add some data
  27. 27. Step 81. Add shortcode
  28. 28. Step 91. Add some CSS/JS
  29. 29. Step 101. Create a Page and add Slider shotcode [dx_display_slideshow]
  30. 30. The Result
  31. 31. Demo
  32. 32. Congratulations!You have built your first WordPress plugin.
  33. 33. License1. It is customary to follow the standard header with information about licensing for the Plugin. Most Plugins use the GPL2 license used by WordPress or a license compatible with the GPL2. To indicate a GPL2 license, include the following lines in your Plugin
  34. 34. General hooks1. register_activation_hook2. register_deactivation_hook3. init4. admin_init5. admin_menu6. add_meta_boxes
  35. 35. Debugging1. WP_DEBUG, SAVEQUERIES, SCRIPT_DEBUG, WP_DEBUG_LOG2. http://codex.wordpress.org/Debugging_i n_WordPress3. http://wordpress.org/extend/plugins/deb ug-bar/
  36. 36. Best Practices1. Find a unique plugin name2. Setup a plugin prefix (it should be related with your brand)3. Use proper constants and functions to detect paths to plugin files4. Create activation and deactivation functions5. Create an uninstall script
  37. 37. Submit on WordPress.org Prepare a readme.txt based on the readme standards The readme would define the plugin page description Apply for a plugin hosting on WordPress.org After the approval, you’ll be able to push to the Subversion repository. 37
  38. 38. Building WordPress plugins курсове и уроци по програмиране , уеб дизайн – безплатно курсове и уроци по програмиране – Телерик академия уроци по програмиране и уеб дизайн за ученици Mario Peshev BG Coder - онлайн състезателна система - online judge форум програмиране, форум уеб дизайн ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NET http://academy.telerik.com програмиране за деца – безплатни курсове и уроци ASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC безплатен SEO курс - оптимизация за търсачки алго академия – състезателно програмиране, състезаниякурсове и уроци по програмиране , книги – безплатно от Наков курс мобилни приложения с iPhone, Android, WP7, PhoneGap http://devwp.eu уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop Дончо Минков - сайт за програмиране free C# book, безплатна книга C#, книга Java, книга C# Николай Костов - блог за програмиране безплатен курс "Качествен програмен код"  безплатен курс "Разработка на софтуер в cloud среда" C# курс, програмиране, безплатно
  39. 39. Free Trainings @ Telerik Academy Telerik Software Academy  academy.telerik.com Telerik Academy @ Facebook  facebook.com/TelerikAcademy Telerik Software Academy Forums  forums.academy.telerik.com