Top Banner
@DAVIDLAIETTA HOOKS, ACTIONS, AND FILTERS OH MY!
16

Hooks, Actions, and Filters Oh My!

Apr 14, 2017

Download

Technology

David Laietta
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Hooks, Actions, and Filters Oh My!

@DAVIDLAIETTAHOOKS, ACTIONS, AND FILTERS OH MY!

Page 2: 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 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

Page 3: Hooks, Actions, and Filters Oh My!

Hooks: Places where you can add your own code.

HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA

Page 4: Hooks, Actions, and Filters Oh My!

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!

Page 5: Hooks, Actions, and Filters Oh My!

Actions: Hooks that let you do something when something else happens

HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA

Page 6: Hooks, Actions, and Filters Oh My!

HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA

Page 7: Hooks, Actions, and Filters Oh My!

Filters: Hooks that let you modify data before or after interacting with the WordPress database

HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA

Page 8: Hooks, Actions, and Filters Oh My!

HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA

Page 9: Hooks, Actions, and Filters Oh My!

do_action()

Setting up our own hooks!

HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA

Page 10: Hooks, Actions, and Filters Oh My!

HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA

Page 11: Hooks, Actions, and Filters Oh My!

A SAMPLE GENESIS LANDING PAGE

Page 12: Hooks, Actions, and Filters Oh My!

HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA

EXAMPLE: CHANGING EXCERPT LENGTH WITH A FILTER

Page 13: Hooks, Actions, and Filters Oh My!

HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA

EXAMPLE: GRAVITY FORMS FILTER

Page 14: Hooks, Actions, and Filters Oh My!

HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA

EXAMPLE: WOOCOMMERCE ACTION AND FILTER

Page 15: Hooks, Actions, and Filters Oh My!

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

Page 16: Hooks, Actions, and Filters Oh My!

@DAVIDLAIETTAQUESTIONS?