We begin with an introduction about why child themes are so important and then dig right into how to create one. In this tutorial we will create a child theme for the TwentyTwenty theme.
Download the Twenty Twenty child theme here.
Code for your functions.php file
/* child style */
function childtheme_enqueue_styles() {
wp_dequeue_style( 'twentytwenty-style' );
wp_enqueue_style( 'parent_style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css' , false,filemtime( get_stylesheet_directory() . '/style.css' ), 'all' );
}
add_action( 'wp_enqueue_scripts', 'childtheme_enqueue_styles', 999 );
Disclaimer: You can help support content creation. If you click some of my links, WP Explainer may get a compensation. I only partner with companies and products that I’d happily recommend to my audience.
Related tutorials
WP Rocket tutorial – WordPress cache plugin for speed optimization
In this tutorial you will learn to setup WP Rocket the best WordPress caching plugin for speed optimization
UptimeRobot review: Best website uptime monitoring tool
UptimeRobot is a great tool for website uptime monitoring and a must-have for any serious website developer, IT professional, online marketeer, server manager or business owner
Mailgun tutorial for beginners
Learn to setup the reliable email delivery service Mailgun with two techniques: API key and SMTP
Free WordPress Cookie Plugin – CookieYes Tutorial
In this tutorial you will learn to install and setup the FREE WordPress cookie plugin: CookieYes
Webtoffee GDPR Cookie Consent tutorial
In this tutorial you will learn to install and setup the best cookie consent plugin for WordPress: Webtoffee Cookie Consent
Polylang tutorial – Time efficient setup
In this tutorial you will learn how to quickly setup a multilanguage website using the free Polylang plugin.
