How to do it...

Follow these steps to create a child theme for the Twenty Twenty theme:

  1. Open the wp-content/themes folder of your WordPress installation and create a new folder called twentytwentychild.
  2. Create a new file called style.css inside the twentytwentychild folder.
  3. Open the style.css file, add the following code to define it as a theme, and save the file:
/*
Theme Name: Twenty Twenty Child
Theme URL:
Description: Twenty Twenty ChildTheme
Author: John Doe
Author URL:
Template: twentytwenty
Version: 1.0.0
Text Domain: twentytwenty-child
*/
  1. Create a new file called functions.php inside the twentytwentychild folder.
  1. Add the following code to the functions.php file in order to include the stylesheet of the parent theme and save the file:
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style',
get_template_directory_uri().'/style.css' );
}
?>
  1. Log in to the WordPress Dashboard as an administrator.
  2. Click the Appearance menu.
  3. Click the Themes option. Now, your theme will appear in the list, as shown in the following screenshot:

  1. Click the Activate button to activate the theme.

Now, you can visit the home page of the site and the child theme will be displayed. However, you will not see any differences compared to the Twenty Twenty  theme as we didn't change any styles or templates.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.50.222