SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
Getting Ready:
Filter Hooks
CustomizeWoo.com
WordPress Filter Hooks 1/2
Allow you to edit / "filter" content just
before this is given back to WordPress
CustomizeWoo.com
WordPress Filter Hooks 2/2
tl;dr: if WP/WC provide apply_filters(
'hook_name' ) you can edit that content
before it is processed
CustomizeWoo.com
Filter Hooks - Example
apply_filters(
'woocommerce_product_description_heading',
__( 'Description', 'woocommerce' ) )
CustomizeWoo.com
Filter Hooks - Example
add_filter(
'woocommerce_product_description_heading',
'edit_heading' );
function edit_heading() {
// do something to edit the heading
}
CustomizeWoo.com
Filter Hooks: apply_filters Syntax
apply_filters( 'hook_name', $value, $args );
● kindly provided by WP/themes/plugins
● $value = filterable content
● $args = variables you can "pass" and use in
your hooked function
CustomizeWoo.com
Filter Hooks: add_filter Syntax
add_filter( 'hook_name', 'func_name', 10, 1 );
● goes in functions.php @ child theme
● same "hook_name" as per apply_filters
● hooked function
● priority = 10 by default / if omitted
● args = 1 by default / if omitted
CustomizeWoo.com
Filter Hooks: function Syntax
function func_name( $value, $args ) {
// do something to $value
return $value;
}
● goes in functions.php @ child theme
● return $value back to the system
CustomizeWoo.com
Filter Hooks: tl;dr Syntax
apply_filters( 'hook_name', $val, $arg1 );
add_filter( 'hook_name', 'func_name', 10, 2 );
function func_name( $val, $arg1 ) { }
CustomizeWoo.com
Filter Hooks: WC Example
apply_filters( 'woocommerce_checkout_show_terms', true );
add_filter( 'woocommerce_checkout_show_terms', 'no_terms' );
function no_terms( $val ) {
$val = false;
return $val;
}
CustomizeWoo.com
Filter Hooks: WC Example
apply_filters( 'woocommerce_checkout_show_terms', true );
add_filter( 'woocommerce_checkout_show_terms', 'no_terms' );
function no_terms( $val ) {
$val = false;
return $val;
}
CustomizeWoo.com
Filter Hooks: Project Checklist
1. Project Specs e.g. "Edit Add Cart Button Label"
2. Search for apply_filters()
3. Hook your function with add_filter()
4. Write your filter function
CustomizeWoo.com
Filter Hooks: Recap
● Help us override WooCommerce etc.
without editing core / template files
(add_filter() and function go in functions.php
@ child theme)
● Not easy to find/code vs do_action() - need
lots of practice and smart file search
CustomizeWoo.com

Weitere ähnliche Inhalte

Was ist angesagt?

Programmers, communicate your intentions
Programmers, communicate your intentionsProgrammers, communicate your intentions
Programmers, communicate your intentionsYael Zaritsky Perez
 
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSencha
 
Managing themes and server environments with extensible configuration arrays
Managing themes and server environments with extensible configuration arraysManaging themes and server environments with extensible configuration arrays
Managing themes and server environments with extensible configuration arraysChris Olbekson
 
feature toggles for ops
feature toggles for opsfeature toggles for ops
feature toggles for opsBram Vogelaar
 
DRUPAL Search API Solr
DRUPAL Search API SolrDRUPAL Search API Solr
DRUPAL Search API SolrAndrew Siz
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsMichael Peacock
 
WordPress Queries - the right way
WordPress Queries - the right wayWordPress Queries - the right way
WordPress Queries - the right wayAnthony Hortin
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationAbdul Malik Ikhsan
 
JQuery Presentation
JQuery PresentationJQuery Presentation
JQuery PresentationSony Jain
 
Codeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework ComponentsCodeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework ComponentsAbdul Malik Ikhsan
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockCaldera Labs
 
HTMLarea to CKEditor - create presets and your own plugin for TYPO3
HTMLarea to CKEditor - create presets and your own plugin for TYPO3HTMLarea to CKEditor - create presets and your own plugin for TYPO3
HTMLarea to CKEditor - create presets and your own plugin for TYPO3Frans Saris
 

Was ist angesagt? (16)

Programmers, communicate your intentions
Programmers, communicate your intentionsProgrammers, communicate your intentions
Programmers, communicate your intentions
 
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
 
Managing themes and server environments with extensible configuration arrays
Managing themes and server environments with extensible configuration arraysManaging themes and server environments with extensible configuration arrays
Managing themes and server environments with extensible configuration arrays
 
feature toggles for ops
feature toggles for opsfeature toggles for ops
feature toggles for ops
 
DRUPAL Search API Solr
DRUPAL Search API SolrDRUPAL Search API Solr
DRUPAL Search API Solr
 
Add loop shortcode
Add loop shortcodeAdd loop shortcode
Add loop shortcode
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
 
WordPress Queries - the right way
WordPress Queries - the right wayWordPress Queries - the right way
WordPress Queries - the right way
 
Msql
Msql Msql
Msql
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept Implementation
 
Bower introduction
Bower introductionBower introduction
Bower introduction
 
JQuery Presentation
JQuery PresentationJQuery Presentation
JQuery Presentation
 
Codeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework ComponentsCodeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework Components
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh Pollock
 
HTMLarea to CKEditor - create presets and your own plugin for TYPO3
HTMLarea to CKEditor - create presets and your own plugin for TYPO3HTMLarea to CKEditor - create presets and your own plugin for TYPO3
HTMLarea to CKEditor - create presets and your own plugin for TYPO3
 

Ähnlich wie WooCommerce: Filter Hooks

Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018
Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018
Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018Damien Carbery
 
How Not to Build a WordPress Plugin
How Not to Build a WordPress PluginHow Not to Build a WordPress Plugin
How Not to Build a WordPress PluginWill Norris
 
Introduction to WordPress Development - Hooks
Introduction to WordPress Development - HooksIntroduction to WordPress Development - Hooks
Introduction to WordPress Development - HooksEdmund Chan
 
WooCommerce: Action Hooks
WooCommerce: Action HooksWooCommerce: Action Hooks
WooCommerce: Action HooksRodolfo Melogli
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentTammy Hart
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practicesmarkparolisi
 
WordPress Hooks Action & Filters
WordPress Hooks Action & FiltersWordPress Hooks Action & Filters
WordPress Hooks Action & FiltersNirav Mehta
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentBrad Williams
 
WordPress Plugin Basics
WordPress Plugin BasicsWordPress Plugin Basics
WordPress Plugin BasicsAmanda Giles
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress PluginBrad Williams
 
Hooked on WordPress: WordCamp Columbus
Hooked on WordPress: WordCamp ColumbusHooked on WordPress: WordCamp Columbus
Hooked on WordPress: WordCamp ColumbusShawn Hooper
 
How To Write a WordPress Plugin
How To Write a WordPress PluginHow To Write a WordPress Plugin
How To Write a WordPress PluginAndy Stratton
 
Getting Started With WordPress Development
Getting Started With WordPress DevelopmentGetting Started With WordPress Development
Getting Started With WordPress DevelopmentAndy Brudtkuhl
 
WordPress Plugins
WordPress PluginsWordPress Plugins
WordPress Pluginsrandyhoyt
 
Developing For The WordPress Customizer
Developing For The WordPress CustomizerDeveloping For The WordPress Customizer
Developing For The WordPress CustomizerAnthony Hortin
 
Developing Plugins For WordPress
Developing Plugins For WordPressDeveloping Plugins For WordPress
Developing Plugins For WordPressLester Chan
 
WordPress plugin #2
WordPress plugin #2WordPress plugin #2
WordPress plugin #2giwoolee
 
Developing for the WordPress Customizer
Developing for the WordPress CustomizerDeveloping for the WordPress Customizer
Developing for the WordPress CustomizerAnthony Hortin
 
Hooking with WordPress
Hooking with WordPressHooking with WordPress
Hooking with WordPressEdward Caissie
 

Ähnlich wie WooCommerce: Filter Hooks (20)

Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018
Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018
Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018
 
How Not to Build a WordPress Plugin
How Not to Build a WordPress PluginHow Not to Build a WordPress Plugin
How Not to Build a WordPress Plugin
 
Introduction to WordPress Development - Hooks
Introduction to WordPress Development - HooksIntroduction to WordPress Development - Hooks
Introduction to WordPress Development - Hooks
 
WooCommerce: Action Hooks
WooCommerce: Action HooksWooCommerce: Action Hooks
WooCommerce: Action Hooks
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme development
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
WordPress Hooks Action & Filters
WordPress Hooks Action & FiltersWordPress Hooks Action & Filters
WordPress Hooks Action & Filters
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
 
WordPress Plugin Basics
WordPress Plugin BasicsWordPress Plugin Basics
WordPress Plugin Basics
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
 
Hooked on WordPress: WordCamp Columbus
Hooked on WordPress: WordCamp ColumbusHooked on WordPress: WordCamp Columbus
Hooked on WordPress: WordCamp Columbus
 
How To Write a WordPress Plugin
How To Write a WordPress PluginHow To Write a WordPress Plugin
How To Write a WordPress Plugin
 
WooCommerce filters
WooCommerce filtersWooCommerce filters
WooCommerce filters
 
Getting Started With WordPress Development
Getting Started With WordPress DevelopmentGetting Started With WordPress Development
Getting Started With WordPress Development
 
WordPress Plugins
WordPress PluginsWordPress Plugins
WordPress Plugins
 
Developing For The WordPress Customizer
Developing For The WordPress CustomizerDeveloping For The WordPress Customizer
Developing For The WordPress Customizer
 
Developing Plugins For WordPress
Developing Plugins For WordPressDeveloping Plugins For WordPress
Developing Plugins For WordPress
 
WordPress plugin #2
WordPress plugin #2WordPress plugin #2
WordPress plugin #2
 
Developing for the WordPress Customizer
Developing for the WordPress CustomizerDeveloping for the WordPress Customizer
Developing for the WordPress Customizer
 
Hooking with WordPress
Hooking with WordPressHooking with WordPress
Hooking with WordPress
 

Mehr von Rodolfo Melogli

WordCamp Italia 2021: da zero a PHP
WordCamp Italia 2021: da zero a PHPWordCamp Italia 2021: da zero a PHP
WordCamp Italia 2021: da zero a PHPRodolfo Melogli
 
WooCommerce: Issues With remove action()
WooCommerce: Issues With remove action()WooCommerce: Issues With remove action()
WooCommerce: Issues With remove action()Rodolfo Melogli
 
WooCommerce: Custom Fields
WooCommerce: Custom FieldsWooCommerce: Custom Fields
WooCommerce: Custom FieldsRodolfo Melogli
 
WooCommerce: Conditional Logic
WooCommerce: Conditional LogicWooCommerce: Conditional Logic
WooCommerce: Conditional LogicRodolfo Melogli
 
WooCommerce: Intro to PHP
WooCommerce: Intro to PHPWooCommerce: Intro to PHP
WooCommerce: Intro to PHPRodolfo Melogli
 
WooCommerce: Intro to CSS
WooCommerce: Intro to CSSWooCommerce: Intro to CSS
WooCommerce: Intro to CSSRodolfo Melogli
 
WooCommerce: Anatomy of a Template File
WooCommerce: Anatomy of a Template FileWooCommerce: Anatomy of a Template File
WooCommerce: Anatomy of a Template FileRodolfo Melogli
 
WooCommerce: Where to Place Customization
WooCommerce: Where to Place CustomizationWooCommerce: Where to Place Customization
WooCommerce: Where to Place CustomizationRodolfo Melogli
 
WooCommerce: Plugin Settings Overview
WooCommerce: Plugin Settings OverviewWooCommerce: Plugin Settings Overview
WooCommerce: Plugin Settings OverviewRodolfo Melogli
 
WooCommerce: Customization Mistakes to Avoid
WooCommerce: Customization Mistakes to AvoidWooCommerce: Customization Mistakes to Avoid
WooCommerce: Customization Mistakes to AvoidRodolfo Melogli
 
WooCommerce: Customization Definitions
WooCommerce: Customization DefinitionsWooCommerce: Customization Definitions
WooCommerce: Customization DefinitionsRodolfo Melogli
 
WooCommerce: Customization FAQ
WooCommerce: Customization FAQWooCommerce: Customization FAQ
WooCommerce: Customization FAQRodolfo Melogli
 
10 PHP Snippets to Increase WooCommerce Sales
10 PHP Snippets to Increase WooCommerce Sales10 PHP Snippets to Increase WooCommerce Sales
10 PHP Snippets to Increase WooCommerce SalesRodolfo Melogli
 
WooCommerce Workshop. INSTALL. SET UP. PUBLISH. SELL.
WooCommerce Workshop. INSTALL. SET UP. PUBLISH. SELL.WooCommerce Workshop. INSTALL. SET UP. PUBLISH. SELL.
WooCommerce Workshop. INSTALL. SET UP. PUBLISH. SELL.Rodolfo Melogli
 
How to Sell ANYTHING with WordPress + WooCommerce
How to Sell ANYTHING with WordPress + WooCommerceHow to Sell ANYTHING with WordPress + WooCommerce
How to Sell ANYTHING with WordPress + WooCommerceRodolfo Melogli
 
WooCommerce Customization Masterclass (WordCamp Dublin 2017)
WooCommerce Customization Masterclass (WordCamp Dublin 2017)WooCommerce Customization Masterclass (WordCamp Dublin 2017)
WooCommerce Customization Masterclass (WordCamp Dublin 2017)Rodolfo Melogli
 
5 Growth Hacking Strategies + Google Analytics tips & tricks
5 Growth Hacking Strategies + Google Analytics tips & tricks5 Growth Hacking Strategies + Google Analytics tips & tricks
5 Growth Hacking Strategies + Google Analytics tips & tricksRodolfo Melogli
 
From Purchase to Customer Satisfaction: 7 Ways to Increase your Sales
From Purchase to Customer Satisfaction: 7 Ways to Increase your SalesFrom Purchase to Customer Satisfaction: 7 Ways to Increase your Sales
From Purchase to Customer Satisfaction: 7 Ways to Increase your SalesRodolfo Melogli
 
Top 15 Sales Generation Techniques (Ecommerce Customer Acquisition)
Top 15 Sales Generation Techniques (Ecommerce Customer Acquisition)Top 15 Sales Generation Techniques (Ecommerce Customer Acquisition)
Top 15 Sales Generation Techniques (Ecommerce Customer Acquisition)Rodolfo Melogli
 

Mehr von Rodolfo Melogli (20)

WordCamp Italia 2021: da zero a PHP
WordCamp Italia 2021: da zero a PHPWordCamp Italia 2021: da zero a PHP
WordCamp Italia 2021: da zero a PHP
 
WooCommerce: Issues With remove action()
WooCommerce: Issues With remove action()WooCommerce: Issues With remove action()
WooCommerce: Issues With remove action()
 
WooCommerce: Custom Fields
WooCommerce: Custom FieldsWooCommerce: Custom Fields
WooCommerce: Custom Fields
 
WooCommerce: Conditional Logic
WooCommerce: Conditional LogicWooCommerce: Conditional Logic
WooCommerce: Conditional Logic
 
WooCommerce: Intro to PHP
WooCommerce: Intro to PHPWooCommerce: Intro to PHP
WooCommerce: Intro to PHP
 
WooCommerce: Intro to CSS
WooCommerce: Intro to CSSWooCommerce: Intro to CSS
WooCommerce: Intro to CSS
 
WooCommerce: Shortcodes
WooCommerce: ShortcodesWooCommerce: Shortcodes
WooCommerce: Shortcodes
 
WooCommerce: Anatomy of a Template File
WooCommerce: Anatomy of a Template FileWooCommerce: Anatomy of a Template File
WooCommerce: Anatomy of a Template File
 
WooCommerce: Where to Place Customization
WooCommerce: Where to Place CustomizationWooCommerce: Where to Place Customization
WooCommerce: Where to Place Customization
 
WooCommerce: Plugin Settings Overview
WooCommerce: Plugin Settings OverviewWooCommerce: Plugin Settings Overview
WooCommerce: Plugin Settings Overview
 
WooCommerce: Customization Mistakes to Avoid
WooCommerce: Customization Mistakes to AvoidWooCommerce: Customization Mistakes to Avoid
WooCommerce: Customization Mistakes to Avoid
 
WooCommerce: Customization Definitions
WooCommerce: Customization DefinitionsWooCommerce: Customization Definitions
WooCommerce: Customization Definitions
 
WooCommerce: Customization FAQ
WooCommerce: Customization FAQWooCommerce: Customization FAQ
WooCommerce: Customization FAQ
 
10 PHP Snippets to Increase WooCommerce Sales
10 PHP Snippets to Increase WooCommerce Sales10 PHP Snippets to Increase WooCommerce Sales
10 PHP Snippets to Increase WooCommerce Sales
 
WooCommerce Workshop. INSTALL. SET UP. PUBLISH. SELL.
WooCommerce Workshop. INSTALL. SET UP. PUBLISH. SELL.WooCommerce Workshop. INSTALL. SET UP. PUBLISH. SELL.
WooCommerce Workshop. INSTALL. SET UP. PUBLISH. SELL.
 
How to Sell ANYTHING with WordPress + WooCommerce
How to Sell ANYTHING with WordPress + WooCommerceHow to Sell ANYTHING with WordPress + WooCommerce
How to Sell ANYTHING with WordPress + WooCommerce
 
WooCommerce Customization Masterclass (WordCamp Dublin 2017)
WooCommerce Customization Masterclass (WordCamp Dublin 2017)WooCommerce Customization Masterclass (WordCamp Dublin 2017)
WooCommerce Customization Masterclass (WordCamp Dublin 2017)
 
5 Growth Hacking Strategies + Google Analytics tips & tricks
5 Growth Hacking Strategies + Google Analytics tips & tricks5 Growth Hacking Strategies + Google Analytics tips & tricks
5 Growth Hacking Strategies + Google Analytics tips & tricks
 
From Purchase to Customer Satisfaction: 7 Ways to Increase your Sales
From Purchase to Customer Satisfaction: 7 Ways to Increase your SalesFrom Purchase to Customer Satisfaction: 7 Ways to Increase your Sales
From Purchase to Customer Satisfaction: 7 Ways to Increase your Sales
 
Top 15 Sales Generation Techniques (Ecommerce Customer Acquisition)
Top 15 Sales Generation Techniques (Ecommerce Customer Acquisition)Top 15 Sales Generation Techniques (Ecommerce Customer Acquisition)
Top 15 Sales Generation Techniques (Ecommerce Customer Acquisition)
 

Kürzlich hochgeladen

Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftAanSulistiyo
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdfMatthew Sinclair
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptxAsmae Rabhi
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样ayvbos
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...gajnagarg
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样ayvbos
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查ydyuyu
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoilmeghakumariji156
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsMonica Sydney
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查ydyuyu
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsMonica Sydney
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Roommeghakumariji156
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.krishnachandrapal52
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...kajalverma014
 

Kürzlich hochgeladen (20)

Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 

WooCommerce: Filter Hooks

  • 2. WordPress Filter Hooks 1/2 Allow you to edit / "filter" content just before this is given back to WordPress CustomizeWoo.com
  • 3. WordPress Filter Hooks 2/2 tl;dr: if WP/WC provide apply_filters( 'hook_name' ) you can edit that content before it is processed CustomizeWoo.com
  • 4. Filter Hooks - Example apply_filters( 'woocommerce_product_description_heading', __( 'Description', 'woocommerce' ) ) CustomizeWoo.com
  • 5. Filter Hooks - Example add_filter( 'woocommerce_product_description_heading', 'edit_heading' ); function edit_heading() { // do something to edit the heading } CustomizeWoo.com
  • 6. Filter Hooks: apply_filters Syntax apply_filters( 'hook_name', $value, $args ); ● kindly provided by WP/themes/plugins ● $value = filterable content ● $args = variables you can "pass" and use in your hooked function CustomizeWoo.com
  • 7. Filter Hooks: add_filter Syntax add_filter( 'hook_name', 'func_name', 10, 1 ); ● goes in functions.php @ child theme ● same "hook_name" as per apply_filters ● hooked function ● priority = 10 by default / if omitted ● args = 1 by default / if omitted CustomizeWoo.com
  • 8. Filter Hooks: function Syntax function func_name( $value, $args ) { // do something to $value return $value; } ● goes in functions.php @ child theme ● return $value back to the system CustomizeWoo.com
  • 9. Filter Hooks: tl;dr Syntax apply_filters( 'hook_name', $val, $arg1 ); add_filter( 'hook_name', 'func_name', 10, 2 ); function func_name( $val, $arg1 ) { } CustomizeWoo.com
  • 10. Filter Hooks: WC Example apply_filters( 'woocommerce_checkout_show_terms', true ); add_filter( 'woocommerce_checkout_show_terms', 'no_terms' ); function no_terms( $val ) { $val = false; return $val; } CustomizeWoo.com
  • 11. Filter Hooks: WC Example apply_filters( 'woocommerce_checkout_show_terms', true ); add_filter( 'woocommerce_checkout_show_terms', 'no_terms' ); function no_terms( $val ) { $val = false; return $val; } CustomizeWoo.com
  • 12. Filter Hooks: Project Checklist 1. Project Specs e.g. "Edit Add Cart Button Label" 2. Search for apply_filters() 3. Hook your function with add_filter() 4. Write your filter function CustomizeWoo.com
  • 13. Filter Hooks: Recap ● Help us override WooCommerce etc. without editing core / template files (add_filter() and function go in functions.php @ child theme) ● Not easy to find/code vs do_action() - need lots of practice and smart file search CustomizeWoo.com