Upload
kan-ouivirach-phd
View
74
Download
2
Embed Size (px)
Citation preview
WordPress Hooks:
The Right Way to Extend Your
WordPress
B Y K A N O U I V I R A C H
http://www.freeiconspng.com/free-images/hook-icon-24086
Research & Development Architect
KAN OUIVIRACHWho am I?
Our WordPress Plugins
ConnectWise Forms Integration
Login Logout Shortcode
Multisite Login LogosWooCommerce Cart
Count Shortcode
WHAT ARE HOOKS?
http://vignette1.wikia.nocookie.net/villains/images/a/a6/Captain_Hook_(Hook).jpg/revision/latest?cb=20140330214655
http://www.punchdrunksports.com/n4s-content/uploads/2015/01/Boxing-Right-Hook.jpg
??????
HOOKS are…• Magic
• Extend WordPress without messing with the core!
• Event-driven programming
• Actions + Filters
How do they work?
What if we want to do
something here?
WORDPRESS
<code>
</code>
Normal Flow
? ? ?
Hook it!
WORDPRESS
<code>
</code>
We write code.
<code>
WORDPRESS
<code>
</code>
<code>
New Flow!!!
2
1
3
Actions vs. Filters
File: wp-includes/plugin.php
File: wp-includes/plugin.php
apply_filters
File: wp-includes/plugin.php
do_action
Actions vs. Filters
do something
change something
File: functions.php
Add text in ‘Footer’
File: functions.php
Make content ‘UPPERCASE’
YOUR OWN HOOK!
Recap• Extend without modifying
• Actions vs. Filters
• Right way to extend WordPress functionality
Thank youhttps://github.com/zkan/wordcamp-bangkok-2017