SlideShare a Scribd company logo
Working with Child Themes
Utsav singh @rathour
Blogs at: http://codepixelz.com
(@codepixelzmedia)
Dev @ Jasper IT Solutions
Because we should.

Why way to theme
bother?
Better
Automattic recommends.
Next developer will thank you.
Bother to Explain?
Of course Not
That is why I am here.
A quick survey:
Who among here...
• Understands what a child theme is?
• has created and used child themes?
Scenario #1
Scenario #2
Let me make some crazy changes to the
theme code.
Oh wow! An Update. *clickity click*
Been there before?
How does it feel?
Enter: Child Theme
• Inherits the functionality of parent theme
• Allows you to:
- Modify Parent theme
- Add Features to the Parent theme

• Safest and easiest way to modify
Like Father Like Son
Like Father Like Son
Is just like the parent.

A little modification here and there
A little features added here and there
Changes are lost while updating, parent theme
Why use Child Theme?
Speeds up Development Process
Overrides the parts of parent theme that you specify,
without actually changing the theme itself.
Great another week or two of
learning 

Nope, this is easier than most of you have
thought it would be.
This is moreover like any other theme.
How to create a Child Theme?
How to create a Child Theme?
How to create a Child Theme?
Create style.css inside the folder and add this
/*
Theme Name: Twenty Thirteen Child Theme
URI: http://codepixelz.com/twenty-thirteen-child/
Description: Twenty Thirteen Child Theme
Author: Utsav Singh Rathour
Author URI: http://codepixelz.com
Template: twentythirteen
Version: 1.0.0
*/
How to create a Child Theme?
How to create a Child Theme?

Why this Kolaveri D?
@import url("../twentythirteen/style.css");
Go Ahead, make CSS changes that you wanted
What next?
to make.
Customize
But I have more than just CSS to
change
Working with Templates

Simply create a file with same name and it
overwrites same file from Parent theme

Eg: header.php in child replaces parent’s header.php
Working with Templates
• Parent’s header.php
wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) );
get_search_form();

• Child’s header.php
wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) );
//get_search_form();
Including a File
• require_once( get_stylesheet_directory() . '/my_included_file.php' );
why get_stylesheet_directory()?
Because get_template_directory() returns Parent themes path.
• get_template_part( 'content', get_post_format() );
Note:
It looks for say, content-video.php on child theme, if not found; before falling back
to content.php on child. Searches for the file in parent.
Handling Functions
• Child’s, functions.php is loaded before
Parent’s functions.php
• you can make the user functions replaceable
by a child theme, by declaring them
conditionally
Handling Functions

Make sure your parent theme has functions defined
this way.
if ( ! function_exists( 'theme_special_nav' ) ) {
function theme_special_nav() {
// Do something.
}
}
But wait…
• Just because you can, doesn’t mean you should.
• Be wise: “Measure Twice, Cut Once”
• Almost anyone can become a parent, but not all are good
parents. And same applies for themes.
Good Parent and Bad Parent
• Good Parent's functions look like:
if ( ! function_exists( 'do_this' ) ) {
//Something here
}

• Bad Parent's functions look like :
function do_this(){
// Something here
}
When not to use Child theme?
• When you are creating a theme and know, you won’t
update
• Using a theme that never updates.
• Because it is confusing to client.
• Because it is a little slow.
Go Ahead! Experiment!
Find more at: http://codex.wordpress.org/Child_Themes
Questions?

More Related Content

What's hot

Child Theming: An Introduction to Wordpress Theme Development with Wordpres...
Child Theming: An Introduction to  Wordpress Theme Development  with Wordpres...Child Theming: An Introduction to  Wordpress Theme Development  with Wordpres...
Child Theming: An Introduction to Wordpress Theme Development with Wordpres...
Aban Nesta
 
WordPress and Child Themes
WordPress and Child ThemesWordPress and Child Themes
WordPress and Child Themes
nairobiwordcamp
 
Customizing word press themes for san diego wordpress user group
Customizing word press themes for san diego wordpress user groupCustomizing word press themes for san diego wordpress user group
Customizing word press themes for san diego wordpress user group
Phelan Riessen
 
Working with WordPress themes
Working with WordPress themesWorking with WordPress themes
Working with WordPress themes
Utsav Singh Rathour
 
Child Themes in WordPress
Child Themes in WordPressChild Themes in WordPress
Child Themes in WordPress
Jeff Cohan
 
What is (not) WordPress
What is (not) WordPressWhat is (not) WordPress
What is (not) WordPress
Nikolay Bachiyski
 
Why you should be using WordPress child themes
Why you should be using WordPress child themesWhy you should be using WordPress child themes
Why you should be using WordPress child themes
Anthony Hortin
 
Child Theme
Child ThemeChild Theme
Child Theme
Shinichi Nishikawa
 
Customizing WordPress Themes
Customizing WordPress ThemesCustomizing WordPress Themes
Customizing WordPress Themes
Laura Hartwig
 
Keeping Your Themes and Plugins Organized.
Keeping Your Themes and Plugins Organized.Keeping Your Themes and Plugins Organized.
Keeping Your Themes and Plugins Organized.
Jacob Martella
 
Introduction to Custom WordPress Themeing
Introduction to Custom WordPress ThemeingIntroduction to Custom WordPress Themeing
Introduction to Custom WordPress Themeing
Jamie Schmid
 
Basic WordPress SEO
Basic WordPress SEOBasic WordPress SEO
Basic WordPress SEO
Christopher Smith
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designers
elliotjaystocks
 
WordPress 101 Sunday Session
WordPress 101 Sunday SessionWordPress 101 Sunday Session
WordPress 101 Sunday Session
pamselle
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
Chandra Prakash Thapa
 
Word press templates
Word press templatesWord press templates
Word press templates
Dan Phiffer
 
WordCamp Kent 2019 - WP 101: Themes & Plugins: What are they, and where do I ...
WordCamp Kent 2019 - WP 101: Themes & Plugins: What are they, and where do I ...WordCamp Kent 2019 - WP 101: Themes & Plugins: What are they, and where do I ...
WordCamp Kent 2019 - WP 101: Themes & Plugins: What are they, and where do I ...
Joe Querin
 
April 2016 - Atlanta WordPress Users Group - Child Themes
April 2016 - Atlanta WordPress Users Group - Child ThemesApril 2016 - Atlanta WordPress Users Group - Child Themes
April 2016 - Atlanta WordPress Users Group - Child Themes
Eric Sembrat
 
Don't Let the Wrong Theme Choice Ruin Your New WordPress Site
Don't Let the Wrong Theme Choice Ruin Your New WordPress SiteDon't Let the Wrong Theme Choice Ruin Your New WordPress Site
Don't Let the Wrong Theme Choice Ruin Your New WordPress Site
BobWP.com
 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme development
Tammy Hart
 

What's hot (20)

Child Theming: An Introduction to Wordpress Theme Development with Wordpres...
Child Theming: An Introduction to  Wordpress Theme Development  with Wordpres...Child Theming: An Introduction to  Wordpress Theme Development  with Wordpres...
Child Theming: An Introduction to Wordpress Theme Development with Wordpres...
 
WordPress and Child Themes
WordPress and Child ThemesWordPress and Child Themes
WordPress and Child Themes
 
Customizing word press themes for san diego wordpress user group
Customizing word press themes for san diego wordpress user groupCustomizing word press themes for san diego wordpress user group
Customizing word press themes for san diego wordpress user group
 
Working with WordPress themes
Working with WordPress themesWorking with WordPress themes
Working with WordPress themes
 
Child Themes in WordPress
Child Themes in WordPressChild Themes in WordPress
Child Themes in WordPress
 
What is (not) WordPress
What is (not) WordPressWhat is (not) WordPress
What is (not) WordPress
 
Why you should be using WordPress child themes
Why you should be using WordPress child themesWhy you should be using WordPress child themes
Why you should be using WordPress child themes
 
Child Theme
Child ThemeChild Theme
Child Theme
 
Customizing WordPress Themes
Customizing WordPress ThemesCustomizing WordPress Themes
Customizing WordPress Themes
 
Keeping Your Themes and Plugins Organized.
Keeping Your Themes and Plugins Organized.Keeping Your Themes and Plugins Organized.
Keeping Your Themes and Plugins Organized.
 
Introduction to Custom WordPress Themeing
Introduction to Custom WordPress ThemeingIntroduction to Custom WordPress Themeing
Introduction to Custom WordPress Themeing
 
Basic WordPress SEO
Basic WordPress SEOBasic WordPress SEO
Basic WordPress SEO
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designers
 
WordPress 101 Sunday Session
WordPress 101 Sunday SessionWordPress 101 Sunday Session
WordPress 101 Sunday Session
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
 
Word press templates
Word press templatesWord press templates
Word press templates
 
WordCamp Kent 2019 - WP 101: Themes & Plugins: What are they, and where do I ...
WordCamp Kent 2019 - WP 101: Themes & Plugins: What are they, and where do I ...WordCamp Kent 2019 - WP 101: Themes & Plugins: What are they, and where do I ...
WordCamp Kent 2019 - WP 101: Themes & Plugins: What are they, and where do I ...
 
April 2016 - Atlanta WordPress Users Group - Child Themes
April 2016 - Atlanta WordPress Users Group - Child ThemesApril 2016 - Atlanta WordPress Users Group - Child Themes
April 2016 - Atlanta WordPress Users Group - Child Themes
 
Don't Let the Wrong Theme Choice Ruin Your New WordPress Site
Don't Let the Wrong Theme Choice Ruin Your New WordPress SiteDon't Let the Wrong Theme Choice Ruin Your New WordPress Site
Don't Let the Wrong Theme Choice Ruin Your New WordPress Site
 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme development
 

Similar to What are child themes, and why use them

Meetup child-themes
Meetup child-themesMeetup child-themes
Meetup child-themes
DaisyOlsen
 
Child themes
Child themesChild themes
Child themes
bobwlsn
 
Firstborn child theme word camp presentation - atlanta 2013
Firstborn child theme   word camp presentation - atlanta 2013Firstborn child theme   word camp presentation - atlanta 2013
Firstborn child theme word camp presentation - atlanta 2013
Evan Mullins
 
WordPress Child Themes
WordPress Child ThemesWordPress Child Themes
WordPress Child Themes
rfair404
 
Intro to child themes
Intro to child themesIntro to child themes
Intro to child themes
vegasgeek
 
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
topher1kenobe
 
Child Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notesChild Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notes
Damien Carbery
 
Howdoesgettemplatepartworksintwentytentheme 110123234953-phpapp02
Howdoesgettemplatepartworksintwentytentheme 110123234953-phpapp02Howdoesgettemplatepartworksintwentytentheme 110123234953-phpapp02
Howdoesgettemplatepartworksintwentytentheme 110123234953-phpapp02
sos informatique
 
WP Joburg Meetup 10: Genesis Framework by Trish Cornelius
WP Joburg Meetup 10: Genesis Framework by Trish CorneliusWP Joburg Meetup 10: Genesis Framework by Trish Cornelius
WP Joburg Meetup 10: Genesis Framework by Trish Cornelius
WPJoburg
 
WordCamp Reno 2011 - Intro to Genesis Child Themes
WordCamp Reno 2011 - Intro to Genesis Child ThemesWordCamp Reno 2011 - Intro to Genesis Child Themes
WordCamp Reno 2011 - Intro to Genesis Child Themes
vegasgeek
 
Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016
David Brattoli
 
The Why, When, How of WordPress Child Themes
The Why, When, How of WordPress Child ThemesThe Why, When, How of WordPress Child Themes
The Why, When, How of WordPress Child Themes
Anthony Hortin
 
Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?
Edmund Turbin
 
Theming moodle technical
Theming moodle   technicalTheming moodle   technical
Theming moodle technical
Alex Walker
 
HTML/CSS for WordPress
HTML/CSS for WordPressHTML/CSS for WordPress
HTML/CSS for WordPress
Kanchha kaji Prajapati
 
WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2
Mizanur Rahaman Mizan
 
Responsive Theme Workshop - WordCamp Columbus 2015
Responsive Theme Workshop - WordCamp Columbus 2015Responsive Theme Workshop - WordCamp Columbus 2015
Responsive Theme Workshop - WordCamp Columbus 2015
Joe Querin
 
WordPress Child Themes
WordPress Child ThemesWordPress Child Themes
WordPress Child Themes
openchamp
 
Week 9 - Introduction to Child Themes
Week 9  - Introduction to Child ThemesWeek 9  - Introduction to Child Themes
Week 9 - Introduction to Child Themes
henri_makembe
 
Intro to WordPress Child Themes
Intro to WordPress Child ThemesIntro to WordPress Child Themes
Intro to WordPress Child Themes
vegasgeek
 

Similar to What are child themes, and why use them (20)

Meetup child-themes
Meetup child-themesMeetup child-themes
Meetup child-themes
 
Child themes
Child themesChild themes
Child themes
 
Firstborn child theme word camp presentation - atlanta 2013
Firstborn child theme   word camp presentation - atlanta 2013Firstborn child theme   word camp presentation - atlanta 2013
Firstborn child theme word camp presentation - atlanta 2013
 
WordPress Child Themes
WordPress Child ThemesWordPress Child Themes
WordPress Child Themes
 
Intro to child themes
Intro to child themesIntro to child themes
Intro to child themes
 
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
 
Child Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notesChild Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notes
 
Howdoesgettemplatepartworksintwentytentheme 110123234953-phpapp02
Howdoesgettemplatepartworksintwentytentheme 110123234953-phpapp02Howdoesgettemplatepartworksintwentytentheme 110123234953-phpapp02
Howdoesgettemplatepartworksintwentytentheme 110123234953-phpapp02
 
WP Joburg Meetup 10: Genesis Framework by Trish Cornelius
WP Joburg Meetup 10: Genesis Framework by Trish CorneliusWP Joburg Meetup 10: Genesis Framework by Trish Cornelius
WP Joburg Meetup 10: Genesis Framework by Trish Cornelius
 
WordCamp Reno 2011 - Intro to Genesis Child Themes
WordCamp Reno 2011 - Intro to Genesis Child ThemesWordCamp Reno 2011 - Intro to Genesis Child Themes
WordCamp Reno 2011 - Intro to Genesis Child Themes
 
Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016
 
The Why, When, How of WordPress Child Themes
The Why, When, How of WordPress Child ThemesThe Why, When, How of WordPress Child Themes
The Why, When, How of WordPress Child Themes
 
Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?
 
Theming moodle technical
Theming moodle   technicalTheming moodle   technical
Theming moodle technical
 
HTML/CSS for WordPress
HTML/CSS for WordPressHTML/CSS for WordPress
HTML/CSS for WordPress
 
WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2
 
Responsive Theme Workshop - WordCamp Columbus 2015
Responsive Theme Workshop - WordCamp Columbus 2015Responsive Theme Workshop - WordCamp Columbus 2015
Responsive Theme Workshop - WordCamp Columbus 2015
 
WordPress Child Themes
WordPress Child ThemesWordPress Child Themes
WordPress Child Themes
 
Week 9 - Introduction to Child Themes
Week 9  - Introduction to Child ThemesWeek 9  - Introduction to Child Themes
Week 9 - Introduction to Child Themes
 
Intro to WordPress Child Themes
Intro to WordPress Child ThemesIntro to WordPress Child Themes
Intro to WordPress Child Themes
 

Recently uploaded

Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 

Recently uploaded (20)

Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
 

What are child themes, and why use them

  • 1.
  • 2. Working with Child Themes Utsav singh @rathour Blogs at: http://codepixelz.com (@codepixelzmedia) Dev @ Jasper IT Solutions
  • 3. Because we should. Why way to theme bother? Better Automattic recommends. Next developer will thank you.
  • 4. Bother to Explain? Of course Not That is why I am here.
  • 5. A quick survey: Who among here... • Understands what a child theme is? • has created and used child themes?
  • 7. Scenario #2 Let me make some crazy changes to the theme code. Oh wow! An Update. *clickity click*
  • 8. Been there before? How does it feel?
  • 9. Enter: Child Theme • Inherits the functionality of parent theme • Allows you to: - Modify Parent theme - Add Features to the Parent theme • Safest and easiest way to modify
  • 11. Like Father Like Son Is just like the parent. A little modification here and there A little features added here and there
  • 12. Changes are lost while updating, parent theme Why use Child Theme? Speeds up Development Process Overrides the parts of parent theme that you specify, without actually changing the theme itself.
  • 13. Great another week or two of learning  Nope, this is easier than most of you have thought it would be. This is moreover like any other theme.
  • 14. How to create a Child Theme?
  • 15. How to create a Child Theme?
  • 16. How to create a Child Theme? Create style.css inside the folder and add this /* Theme Name: Twenty Thirteen Child Theme URI: http://codepixelz.com/twenty-thirteen-child/ Description: Twenty Thirteen Child Theme Author: Utsav Singh Rathour Author URI: http://codepixelz.com Template: twentythirteen Version: 1.0.0 */
  • 17. How to create a Child Theme?
  • 18.
  • 19. How to create a Child Theme? Why this Kolaveri D? @import url("../twentythirteen/style.css");
  • 20.
  • 21. Go Ahead, make CSS changes that you wanted What next? to make. Customize
  • 22. But I have more than just CSS to change
  • 23. Working with Templates Simply create a file with same name and it overwrites same file from Parent theme Eg: header.php in child replaces parent’s header.php
  • 24. Working with Templates • Parent’s header.php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); get_search_form(); • Child’s header.php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); //get_search_form();
  • 25.
  • 26. Including a File • require_once( get_stylesheet_directory() . '/my_included_file.php' ); why get_stylesheet_directory()? Because get_template_directory() returns Parent themes path. • get_template_part( 'content', get_post_format() ); Note: It looks for say, content-video.php on child theme, if not found; before falling back to content.php on child. Searches for the file in parent.
  • 27. Handling Functions • Child’s, functions.php is loaded before Parent’s functions.php • you can make the user functions replaceable by a child theme, by declaring them conditionally
  • 28. Handling Functions Make sure your parent theme has functions defined this way. if ( ! function_exists( 'theme_special_nav' ) ) { function theme_special_nav() { // Do something. } }
  • 29. But wait… • Just because you can, doesn’t mean you should. • Be wise: “Measure Twice, Cut Once” • Almost anyone can become a parent, but not all are good parents. And same applies for themes.
  • 30. Good Parent and Bad Parent • Good Parent's functions look like: if ( ! function_exists( 'do_this' ) ) { //Something here } • Bad Parent's functions look like : function do_this(){ // Something here }
  • 31. When not to use Child theme? • When you are creating a theme and know, you won’t update • Using a theme that never updates. • Because it is confusing to client. • Because it is a little slow.
  • 32. Go Ahead! Experiment! Find more at: http://codex.wordpress.org/Child_Themes