Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

php[world] Hooks, Actions and Filters Oh My!

332 views

Published on

A basic primer for WordPress Hooks, Actions, and Filters. If you are getting started with WordPress and have basic PHP knowledge, these examples are a quick demonstration of how to extend and expand upon WordPress for your sites and your clients.

Published in: Internet
  • Be the first to comment

php[world] Hooks, Actions and Filters Oh My!

  1. 1. @DAVIDLAIETTA HOOKS, ACTIONS, AND FILTERS OH MY!
  2. 2. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA WHY USE HOOKS? ▸ Most WordPress features use actions and filters that you can modify to change how WordPress fundamentally works ▸ You can make complex changes easily without editing core, or existing plugins or themes that you’ve purchased ▸ Make changes at the source, instead of hacking away ▸ Upgrade without worry of losing your modifications ▸ Enable and disable your changes easily obm.io/php2015-hooks
  3. 3. Hooks: Places where you can add your own code. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA obm.io/php2015-hooks
  4. 4. Mr. WordPress HOW A HOOK IS BORN I’m going to do this thing. Before you do your thing, I’ve got this other thing that I want to do. Mr. WordPress Ms. Plugin Ok, do your thing, then I’ll do my thing! obm.io/php2015-hooks
  5. 5. Actions: Hooks that let you do something when something else happens HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA obm.io/php2015-hooks
  6. 6. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA obm.io/php2015-hooks
  7. 7. Filters: Hooks that let you modify data before or after interacting with the WordPress database HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA obm.io/php2015-hooks
  8. 8. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA obm.io/php2015-hooks
  9. 9. do_action() Setting up our own hooks! HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA obm.io/php2015-hooks
  10. 10. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA obm.io/php2015-hooks
  11. 11. A SAMPLE GENESIS LANDING PAGE obm.io/php2015-hooks
  12. 12. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA EXAMPLE: CHANGING EXCERPT LENGTH WITH A FILTER obm.io/php2015-hooks
  13. 13. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA EXAMPLE: GRAVITY FORMS FILTER obm.io/php2015-hooks
  14. 14. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA EXAMPLE: WOOCOMMERCE ACTION AND FILTER obm.io/php2015-hooks
  15. 15. RESOURCES ▸ http://codex.wordpress.org/Plugin_API/Action_Reference ▸ http://codex.wordpress.org/Plugin_API/Filter_Reference ▸ http://blog.teamtreehouse.com/hooks-wordpress-actions- filters-examples ▸ https://docs.woothemes.com/document/hooks/ ▸ https://www.gravityhelp.com/documentation/category/hooks/ ▸ http://genesistutorials.com/visual-hook-guide/ HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA obm.io/php2015-hooks
  16. 16. @davidlaietta obm.io/php2015-hooks QUESTIONS?

×