SlideShare a Scribd company logo
1 of 19
Playing Ball With
Plugins
Navigating and Extending Large Codebases:
A Field Guide
https://marcgratch.com | mgratch
WordCamp Boston 2017
Defining Your Problem
Make sure you’re solving a real problem
https://marcgratch.com | mgratch
WordCamp Boston 2017
Make sure you’re solving a real problem
• Is this behavior self-inflicted or inherent to the
plugin?
• Does this (will this) behavior bother the client? (Or is
it just me?)
• Will this impact launch?
• Can it be fixed with a bit of CSS?
https://marcgratch.com | mgratch
WordCamp Boston 2017
Be Aware: Dangerous Territory
Extending another plugin can get messy
https://marcgratch.com | mgratch
WordCamp Boston 2017
Some “dangers” of Extending/Integrating with
a 3rd Party Plugin
•Is the plugin regularly maintained?
•Are the plugin updates (typically) backwards
compatible?
•Did you ensure your code is maintainable?
https://marcgratch.com | mgratch
WordCamp Boston 2017
READ THE DOCS!
Seriously…
https://marcgratch.com | mgratch
WordCamp Boston 2017
Find a Good Place to Start:
Defining your Goal
• Making a Change on the Frontend:
• Determine what file manages where (or near) your final code will need to output (or
need to modify.)
• Look at the source code (in the browser)
• Find unique strings to search for. (HTML classes or IDs are usually a good place to
start.)
• Search the plugins code base for this unique string.
https://marcgratch.com | mgratch
WordCamp Boston 2017
Find a Good Place to Start:
Defining your Goal
• Making a Change on the Backend:
• READ THE DOCS
• Try to identify the function(s)handling the data you wish to change.
• Search All Files in the Plugin for `apply_filters` or `do_action`
• USE BREAK POINTS / XDEBUG / STEP THROUGH
https://marcgratch.com | mgratch
WordCamp Boston 2017
Hooks: They’re Magical
Nothing clever here… they really are.
https://marcgratch.com | mgratch
WordCamp Boston 2017
Hooks: They’re Magical
• Event Driven Programming
• Complex Changes Without Modifying Core Files
• Modify Data at the Source
• Upgrade Safely (typically)
• Backwards Compatible!!!! (typically)
https://marcgratch.com | mgratch
WordCamp Boston 2017
Pluggable Functions &
Overriding templates
The dangers within.
https://marcgratch.com | mgratch
WordCamp Boston 2017
Overriding Functions: Pluggable Functions
if ( ! function_exists( ‘some_function’ ) ) {
// do something different
}
• You can only do this once
• Only works as long as the pluggable function exists
https://marcgratch.com | mgratch
WordCamp Boston 2017
Pluggable “Template” Files
• When the original file is updated… yours will
remain. Old & Outdated.
• Multiple implementations are problematic.
• Only works as long as the original file exists/used
or no longer performs its intended function.
https://marcgratch.com | mgratch
WordCamp Boston 2017
Modifying Returned Content
• DO NOT MODIFY HTML WITH str_replace()
• Browsers are lenient – not all HTML is written the same.
• Modifying return HTML requires
DOMDocument Class
• Make sure the `class_exists(‘DOMDocument’)`
https://marcgratch.com | mgratch
WordCamp Boston 2017
If All Else Fails: Write a Patch
Then ask the plugin developers to implement it…
https://marcgratch.com | mgratch
WordCamp Boston 2017
Asking for a Change to the Core Plugin:
•Be Polite
•Identify if it’s an Edge Case
•Explain the Reason for your Patch
•Offer to fix another bug if you can…
https://marcgratch.com | mgratch
WordCamp Boston 2017
Asking for a Change to the Core Plugin:
…the other reason I was reaching out was in regards to submitting patches. I
realize it is likely an edge case, but I am hopeful that you might be willing to
consider implementing the attached patch. It simply adds the ability to add custom
fields (or content) to the bottom of the `getImageTab` output. I have tested it and
written further unit tests for it. The patch appears to work as expected.
Furthermore, I am familiar with your code base and I am happy to help with any
other bugs or roadmap features as I continue to work with your plugin…
https://marcgratch.com | mgratch
WordCamp Boston 2017
Asking for a Change to the Core Plugin:
First let me say I have been using your plugin since 2012 and I am always happy
to support good plugins and their authors.
I am hopeful you are willing to consider implementing the attached patch. It
allows form submission via AJAX. I am building a single page app and
honestly your plugin does everything I need except post back is killing the
experience. I have tested it on a vanilla WP install and it seems to be working.
If you run unit tests I am happy to write a few for this new functionality as
well…
https://marcgratch.com | mgratch
WordCamp Boston 2017
Great Resources
wptavern.com make.wordpress.org tommcfarlin.com
poststatus.com wordpress.tv pippinsplugins.com
joshpress.net wpchat.com carriedils.com
tuts+ wpbeginner.com carlalexander.ca
torquemag.io wpmayor.com yoast.com
wpshout.com helenhousandi.com gravitywiz.com
wplift.com chrislema.com webdevstudios.com
hookr.io
https://marcgratch.com | mgratch
WordCamp Boston 2017

More Related Content

Similar to playing ball with plugins WCBOS17.pptx

WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentWordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentEvan Mullins
 
Progressive Enhancement with JavaScript and Ajax
Progressive Enhancement with JavaScript and AjaxProgressive Enhancement with JavaScript and Ajax
Progressive Enhancement with JavaScript and AjaxChristian Heilmann
 
How to build simple web apps to automate your SEO tasks - BrightonSEO Spring ...
How to build simple web apps to automate your SEO tasks - BrightonSEO Spring ...How to build simple web apps to automate your SEO tasks - BrightonSEO Spring ...
How to build simple web apps to automate your SEO tasks - BrightonSEO Spring ...Charly Wargnier
 
Grails Worst Practices
Grails Worst PracticesGrails Worst Practices
Grails Worst PracticesBurt Beckwith
 
Introjs10.5.17SD
Introjs10.5.17SDIntrojs10.5.17SD
Introjs10.5.17SDThinkful
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applicationsVittorio Vittori
 
Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010Christian Heilmann
 
Midwest PHP 2017 DevOps For Small team
Midwest PHP 2017 DevOps For Small teamMidwest PHP 2017 DevOps For Small team
Midwest PHP 2017 DevOps For Small teamJoe Ferguson
 
Intro To Django
Intro To DjangoIntro To Django
Intro To DjangoUdi Bauman
 
OOScss Architecture For Rails Apps
OOScss Architecture For Rails AppsOOScss Architecture For Rails Apps
OOScss Architecture For Rails AppsNetguru
 
Rapid Prototyping with Sass, Compass and Middleman by Bermon Painter
Rapid Prototyping with Sass, Compass and Middleman by Bermon PainterRapid Prototyping with Sass, Compass and Middleman by Bermon Painter
Rapid Prototyping with Sass, Compass and Middleman by Bermon PainterCodemotion
 
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...DevSecCon
 
Professional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsProfessional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsMike Wilcox
 
We continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellWe continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellPVS-Studio
 
Xdebug for Beginners
Xdebug for BeginnersXdebug for Beginners
Xdebug for BeginnersSean Prunka
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsDECK36
 
Stapling and patching the web of now - ForwardJS3, San Francisco
Stapling and patching the web of now - ForwardJS3, San FranciscoStapling and patching the web of now - ForwardJS3, San Francisco
Stapling and patching the web of now - ForwardJS3, San FranciscoChristian Heilmann
 

Similar to playing ball with plugins WCBOS17.pptx (20)

WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentWordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
 
Progressive Enhancement with JavaScript and Ajax
Progressive Enhancement with JavaScript and AjaxProgressive Enhancement with JavaScript and Ajax
Progressive Enhancement with JavaScript and Ajax
 
How to build simple web apps to automate your SEO tasks - BrightonSEO Spring ...
How to build simple web apps to automate your SEO tasks - BrightonSEO Spring ...How to build simple web apps to automate your SEO tasks - BrightonSEO Spring ...
How to build simple web apps to automate your SEO tasks - BrightonSEO Spring ...
 
Grails Worst Practices
Grails Worst PracticesGrails Worst Practices
Grails Worst Practices
 
Introjs10.5.17SD
Introjs10.5.17SDIntrojs10.5.17SD
Introjs10.5.17SD
 
Tasting Your First Test Burger
Tasting Your First Test BurgerTasting Your First Test Burger
Tasting Your First Test Burger
 
Teams, styles and scalable applications
Teams, styles and scalable applicationsTeams, styles and scalable applications
Teams, styles and scalable applications
 
Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010
 
Midwest PHP 2017 DevOps For Small team
Midwest PHP 2017 DevOps For Small teamMidwest PHP 2017 DevOps For Small team
Midwest PHP 2017 DevOps For Small team
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
 
Shifting Gears
Shifting GearsShifting Gears
Shifting Gears
 
Web Optimisation
Web OptimisationWeb Optimisation
Web Optimisation
 
OOScss Architecture For Rails Apps
OOScss Architecture For Rails AppsOOScss Architecture For Rails Apps
OOScss Architecture For Rails Apps
 
Rapid Prototyping with Sass, Compass and Middleman by Bermon Painter
Rapid Prototyping with Sass, Compass and Middleman by Bermon PainterRapid Prototyping with Sass, Compass and Middleman by Bermon Painter
Rapid Prototyping with Sass, Compass and Middleman by Bermon Painter
 
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
 
Professional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsProfessional JavaScript: AntiPatterns
Professional JavaScript: AntiPatterns
 
We continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellWe continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShell
 
Xdebug for Beginners
Xdebug for BeginnersXdebug for Beginners
Xdebug for Beginners
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
 
Stapling and patching the web of now - ForwardJS3, San Francisco
Stapling and patching the web of now - ForwardJS3, San FranciscoStapling and patching the web of now - ForwardJS3, San Francisco
Stapling and patching the web of now - ForwardJS3, San Francisco
 

Recently uploaded

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 

playing ball with plugins WCBOS17.pptx

  • 1. Playing Ball With Plugins Navigating and Extending Large Codebases: A Field Guide https://marcgratch.com | mgratch WordCamp Boston 2017
  • 2. Defining Your Problem Make sure you’re solving a real problem https://marcgratch.com | mgratch WordCamp Boston 2017
  • 3. Make sure you’re solving a real problem • Is this behavior self-inflicted or inherent to the plugin? • Does this (will this) behavior bother the client? (Or is it just me?) • Will this impact launch? • Can it be fixed with a bit of CSS? https://marcgratch.com | mgratch WordCamp Boston 2017
  • 4. Be Aware: Dangerous Territory Extending another plugin can get messy https://marcgratch.com | mgratch WordCamp Boston 2017
  • 5. Some “dangers” of Extending/Integrating with a 3rd Party Plugin •Is the plugin regularly maintained? •Are the plugin updates (typically) backwards compatible? •Did you ensure your code is maintainable? https://marcgratch.com | mgratch WordCamp Boston 2017
  • 6. READ THE DOCS! Seriously… https://marcgratch.com | mgratch WordCamp Boston 2017
  • 7. Find a Good Place to Start: Defining your Goal • Making a Change on the Frontend: • Determine what file manages where (or near) your final code will need to output (or need to modify.) • Look at the source code (in the browser) • Find unique strings to search for. (HTML classes or IDs are usually a good place to start.) • Search the plugins code base for this unique string. https://marcgratch.com | mgratch WordCamp Boston 2017
  • 8. Find a Good Place to Start: Defining your Goal • Making a Change on the Backend: • READ THE DOCS • Try to identify the function(s)handling the data you wish to change. • Search All Files in the Plugin for `apply_filters` or `do_action` • USE BREAK POINTS / XDEBUG / STEP THROUGH https://marcgratch.com | mgratch WordCamp Boston 2017
  • 9. Hooks: They’re Magical Nothing clever here… they really are. https://marcgratch.com | mgratch WordCamp Boston 2017
  • 10. Hooks: They’re Magical • Event Driven Programming • Complex Changes Without Modifying Core Files • Modify Data at the Source • Upgrade Safely (typically) • Backwards Compatible!!!! (typically) https://marcgratch.com | mgratch WordCamp Boston 2017
  • 11. Pluggable Functions & Overriding templates The dangers within. https://marcgratch.com | mgratch WordCamp Boston 2017
  • 12. Overriding Functions: Pluggable Functions if ( ! function_exists( ‘some_function’ ) ) { // do something different } • You can only do this once • Only works as long as the pluggable function exists https://marcgratch.com | mgratch WordCamp Boston 2017
  • 13. Pluggable “Template” Files • When the original file is updated… yours will remain. Old & Outdated. • Multiple implementations are problematic. • Only works as long as the original file exists/used or no longer performs its intended function. https://marcgratch.com | mgratch WordCamp Boston 2017
  • 14. Modifying Returned Content • DO NOT MODIFY HTML WITH str_replace() • Browsers are lenient – not all HTML is written the same. • Modifying return HTML requires DOMDocument Class • Make sure the `class_exists(‘DOMDocument’)` https://marcgratch.com | mgratch WordCamp Boston 2017
  • 15. If All Else Fails: Write a Patch Then ask the plugin developers to implement it… https://marcgratch.com | mgratch WordCamp Boston 2017
  • 16. Asking for a Change to the Core Plugin: •Be Polite •Identify if it’s an Edge Case •Explain the Reason for your Patch •Offer to fix another bug if you can… https://marcgratch.com | mgratch WordCamp Boston 2017
  • 17. Asking for a Change to the Core Plugin: …the other reason I was reaching out was in regards to submitting patches. I realize it is likely an edge case, but I am hopeful that you might be willing to consider implementing the attached patch. It simply adds the ability to add custom fields (or content) to the bottom of the `getImageTab` output. I have tested it and written further unit tests for it. The patch appears to work as expected. Furthermore, I am familiar with your code base and I am happy to help with any other bugs or roadmap features as I continue to work with your plugin… https://marcgratch.com | mgratch WordCamp Boston 2017
  • 18. Asking for a Change to the Core Plugin: First let me say I have been using your plugin since 2012 and I am always happy to support good plugins and their authors. I am hopeful you are willing to consider implementing the attached patch. It allows form submission via AJAX. I am building a single page app and honestly your plugin does everything I need except post back is killing the experience. I have tested it on a vanilla WP install and it seems to be working. If you run unit tests I am happy to write a few for this new functionality as well… https://marcgratch.com | mgratch WordCamp Boston 2017
  • 19. Great Resources wptavern.com make.wordpress.org tommcfarlin.com poststatus.com wordpress.tv pippinsplugins.com joshpress.net wpchat.com carriedils.com tuts+ wpbeginner.com carlalexander.ca torquemag.io wpmayor.com yoast.com wpshout.com helenhousandi.com gravitywiz.com wplift.com chrislema.com webdevstudios.com hookr.io https://marcgratch.com | mgratch WordCamp Boston 2017