April 2016 - Atlanta WordPress Users Group - Child Themes

Preview:

Citation preview

Child ThemesTHEMECEPTION - THEME SANITY

Body Level One

http://www.webbeh.com

Let’s Consider a Story.You’ve probably done this before…

*click*

Enter: Child ThemesIt’s all about inheritance.

• Purpose• Extend, customize, override an existing theme (parent theme) without editing any of the theme’s files.

• To modify a theme while leaving the parent theme intact.

Child Themes

• Parent theme can be updated without worry.• Goodbye, overwritten customizations!

• Reuse the parent theme options across multiple sites!• Customize in child themes for site-specific tweaks.

• Override, extend, or replace hooks and calls.

Benefit?

Page Request

Parent Theme

Child Theme

[insert magic here]

Page Delivery

• 3 things needed to create a child theme.

How to Create?

1. A Folder

2. style.css

2. style.css

2. style.css

3. functions.php *

You’re Done!

• You created a subfolder in /wp-content/themes for your child theme.

• You created a styles.css and populated it with the comment information for WordPress to identify it as a theme (with a parent).

• You created a functions.php to store theme-specific PHP.

What did you just do?

How does this help?

Page Request

Parent Theme

Child Theme

[insert magic here]

Page Delivery

Page Request

Parent Theme

Child Theme

[insert magic here]

Page Delivery

Hooks Added Here

Hooks Overridden Here

• You can write and include your own JS, CSS, and theme files.

• You can write your own PHP functions.php settings for:• Customize the Customizer• Customize the theme display• Customize the widget areas• etc.

• And you can write your own page templates!

Features

• This is especially helpful if you have consistency on reusable components when building theme products.• Parent theme has all foundational components (widget areas, media queries, etc.)

• Child theme(s) has the unique style and theme-specific functionality.

Helpful for Frameworks

• This is especially helpful if you have consistency on reusable components when building theme products.• Parent theme has all foundational components (widget areas, media queries, etc.)

• Child theme(s) has the unique style and theme-specific functionality.

Helpful for Frameworks

How does this help?

How does this help?

How does this help?

How does this help?

Page… Templates?