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.
@DAVIDLAIETTA
HOOKS, ACTIONS, AND FILTERS OH MY!
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
WHY USE HOOKS?
▸ Most WordPress features use actions and filters that you ...
Hooks: Places where you
can add your own code.
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
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 wa...
Actions: Hooks that let
you do something when
something else happens
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
Filters: Hooks that let you
modify data before or
after interacting with the
WordPress database
HOOKS, ACTIONS, AND FILTER...
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
do_action()
Setting up our own hooks!
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
A SAMPLE GENESIS LANDING PAGE
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
EXAMPLE: CHANGING EXCERPT LENGTH WITH A FILTER
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
EXAMPLE: GRAVITY FORMS FILTER
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
EXAMPLE: WOOCOMMERCE ACTION AND FILTER
RESOURCES
▸ http://codex.wordpress.org/Plugin_API/Action_Reference
▸ http://codex.wordpress.org/Plugin_API/Filter_Referenc...
@DAVIDLAIETTA
QUESTIONS?
Upcoming SlideShare
Loading in …5
×

Hooks, Actions, and Filters Oh My!

1,022 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: Technology
  • Be the first to comment

  • Be the first to like this

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
  3. 3. Hooks: Places where you can add your own code. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
  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!
  5. 5. Actions: Hooks that let you do something when something else happens HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
  6. 6. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
  7. 7. Filters: Hooks that let you modify data before or after interacting with the WordPress database HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
  8. 8. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
  9. 9. do_action() Setting up our own hooks! HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
  10. 10. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
  11. 11. A SAMPLE GENESIS LANDING PAGE
  12. 12. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA EXAMPLE: CHANGING EXCERPT LENGTH WITH A FILTER
  13. 13. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA EXAMPLE: GRAVITY FORMS FILTER
  14. 14. HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA EXAMPLE: WOOCOMMERCE ACTION AND FILTER
  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/ HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
  16. 16. @DAVIDLAIETTA QUESTIONS?

×