Skip to content
+91 89607 57615
Code Craft — web development and digital marketing
Lesson 624 min

Child themes and theme.json

Make the bakery's brand part of the theme files, safely, with a block child theme.

Taught by Sandesh Sahetiya

The video is part of the full course

In this lesson you will

  • Explain why child themes exist
  • Create a block child theme with style.css
  • Set colours and element styles in theme.json
  • Activate it and check the result

Never edit a theme's own files: the next update overwrites them. A child theme sits on top of a parent theme and holds only your changes. WordPress loads the parent, then applies the child.

style.css: the only required file

wp-content/themes/sunrise-child/style.cssDownload
/*
Theme Name:   Sunrise Child
Template:     twentytwentyfive
Description:  Child theme for Sunrise Bakery, built on Twenty Twenty-Five.
Version:      1.0.0
Requires at least: 6.7
Requires PHP: 7.4
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  sunrise-child
*/

/*
 * In a block theme, colours, fonts and spacing live in theme.json.
 * Use this file only for small extras that theme.json can't express.
 */

Add an optional screenshot.png or screenshot.jpg, 1200 × 900 pixels, and WordPress shows it as the theme's preview under Appearance › Themes. The course's one is a real capture of the bakery shop.

Template must exactly match the parent theme's folder name, here twentytwentyfive. For block themes, you usually don't need a functions.php or to load the parent's stylesheet: styling lives in theme.json.

Continue with the full course

The rest of this lesson, the narrated video, the PDF and the exercise are part of WordPress and WooCommerce. One payment, lifetime access.

Already bought it? Sign in with the email you paid with.