How to create child theme for any theme?

To create a child theme for any theme, you will need to follow these steps:

  1. Create a new folder in your WordPress installation’s wp-content/themes directory. This folder will contain your child theme files.
  2. Create a style.css file in the new folder. This file will contain the styles for your child theme.
  3. In the style.css file, add the following lines at the top:
/*
 Theme Name: My Child Theme
 Theme URI: 
 Description: My child theme
 Author: Your Name
 Author URI: 
 Template: parent-theme-folder-name
 Version: 1.0.0
*/

  1. Replace My Child Theme with the name of your child theme, and parent-theme-folder-name with the folder name of the parent theme.
  2. Add any custom styles for your child theme in the style.css file below the comments.
  3. Create a functions.php file in the new folder. This file will contain the functions for your child theme.
  4. In the functions.php file, add the following lines:
<?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. Activate the child theme through the WordPress admin dashboard by going to Appearance > Themes.

That’s it! Your child theme should now be active and you can start customizing the appearance of your site by modifying the styles in the style.css file and adding custom functions in the functions.php file.