If you want to modify a theme which have regularly updated than you need to make create child theme. With child theme you can make change small modification and preserve the original theme design and functionality and still get update from the parent theme. Because the original newest theme from wordpress is twenty twenty theme , So in this tutorial i will show how create twenty twenty child theme.
To make twenty-twenty child theme you must make folder twentytwenty-child in wp-content/themes/ and create style.css and functions.php
So the structure is like this :
- wp-content/themes/twentytwenty-child
- wp-content/themes/twentytwenty-child/style.css
- wp-content/themes/twentytwenty-child/functions.php
- wp-content/themes/twentytwenty-child/screenshot.png (optional file , with size 1200×900)
Create twentytwenty-child folder
First you must go to directory /wp-content/themes/ than create a folder twentytwenty-child . This folder contain all modification for child theme. Make sure that folder has folder twentytwenty as parent theme so the child theme can work.
Create style.css
In folder twentytwenty-child create file style.css which has contain like this :
/*
Theme Name: Twenty Twenty Child
Theme URL: http://wpamanuke.com/
Description: Twenty Twenty Child Theme
Author: WPAmaNuke
Author URL: http://wpamanuke.com/
Template: twentytwenty
Version: 1.0.0
Text Domain: twentytwenty-child
*/
/* Custom CSS goes after this line */
h2.entry-title {
background-color:#ff0000;
}
h1.entry-title {
background-color:#ff0000;
}
Note :
- Theme Name : Your child theme name , it must be unique
- Template : Your parent theme directory. Parent theme folder is twentytwenty
- Text Domain : is to make theme translatable using po/mo files
Create functions.php
In folder twentytwenty-child create file functions.php which has contain like this to include style.css from parent theme :
<?php
add_action( 'wp_enqueue_scripts', 'tt_child_enqueue_parent_styles' );
function tt_child_enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>
That’s all the basic knowledge to modify / update Twenty Twenty child theme. It’s still basic but you can extend the functions and style. This child theme only change the title post background become red. After that to activate the theme from wp-admin in the Appearance -> Themes