Presentation slides for the 16 Mar 2020 WordPress Singapore Meet-up. Visit https://www.edmundcwm.com/presentations/ to view other presentation resources.
- What isa Child Theme
- Why use a Child Theme
- When to use a Child Theme
- How to create a Child Theme
- Demo
Agenda
4.
The parent andchild theme relationship
What is a Child Theme
5.
Parent theme
- Afull theme consisting of all required files/templates
for a theme to work
- Becomes a parent theme if declared by a child
theme
- E.g., TwentyTwenty, GeneratePress, Underscores,
Astra
What is a Child Theme
What is aChild Theme
Child theme Parent themeFull theme
8.
Child theme
- Atheme that is intended to work with the parent
theme
- Inherits the parent theme’s look and functions
- Changes only parts that you want to be different
- Cannot work without a parent theme
What is a Child Theme
What is aChild Theme
Parent theme Child theme
Any file (except functions.php) added to
them child theme will override the same
file in the parent theme
Why use aChild Theme
- Allows you to safely modify the Parent theme
18.
Why use aChild Theme
- Allows you to safely modify the Parent theme
- Speeds up development time i.e., build on something
that already exists
19.
Why use aChild Theme
- Allows you to safely modify the Parent theme
- Speeds up development time i.e., build on something
that already exists
- Updates on parent theme will flow seamlessly into child
theme
20.
Why use aChild Theme
- Allows you to safely modify the Parent theme
- Speeds up development time i.e., build on something
that already exists
- Updates on parent theme will flow seamlessly into child
theme
- Great way to learn about how themes work in WP
When to usea Child Theme
If you are:
- constantly adding new functions or modifying styles
23.
When to usea Child Theme
If you are:
- constantly adding new functions or modifying styles
- introducing larger changes like template overrides
24.
When to usea Child Theme
If you are:
- constantly adding new functions or modifying styles
- introducing larger changes like template overrides
- not building a theme from scratch
How to createa Child Theme
With a plugin - Child Theme Generator
27.
How to createa Child Theme
Without a plugin
1. Create a new folder in the themes directory
• Best practice to use the same name as parent and
appending “-child”
28.
How to createa Child Theme
Without a plugin
2. Create a “style.css” file (required)
29.
How to createa Child Theme
Without a plugin
3. Insert required header comment at the top of “style.css”
• “Template” must match the name of the parent theme
directory
30.
How to createa Child Theme
Without a plugin
4. Create a “functions.php”
31.
How to createa Child Theme
Without a plugin
5. Enqueue parent and child theme styles