If you want to use a plugin, there are many plugins out there to customise WordPress themes. As for the Twenty Twenty-one theme, I recommended Options for Twenty Twenty-One and Twentig plugins.
I prefer making a child theme, however.
Here is how to make your child theme for Twenty Twenty-one WordPress theme.
- Create a child theme folder under ‘wp-content/themes/’ and name it ‘twentytwentyone-child’.
- Create a PHP file, name it ‘functions.php’, and place it in the child theme folder. The PHP file should contain the following code:
//CORE FUNCTION FOR CHILD THEME add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); function my_theme_enqueue_styles() { $parenthandle = 'twenty-twenty-one-style'; // This is 'twenty-twenty-one-style' for the Twenty Twenty-one theme. $theme = wp_get_theme(); wp_enqueue_style( $parenthandle, get_template_directory_uri() . '/style.css', array(), // if the parent theme code has a dependency, copy it to here $theme->parent()->get('Version') ); wp_enqueue_style( 'custom-style', get_stylesheet_uri(), array( $parenthandle ), $theme->get('Version') // this only works if you have Version in the style header ); }
- Create a CSS file, name it ‘style.css’, and place it in the child theme folder. The CSS file should contain the following code*:
/* Theme Name: Twenty Twenty-One Child Theme URI: https://aung.com.au/ Description: A child theme of Twenty Twenty-One WordPress theme. Author: SoftCode Web Solutions Author URI: https://softcode.com.au Template: twentytwentyone Version: 1.0.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html */ @import url("../twentytwentyone/style.css");
*Your own Theme URI and Author information should be used.
- Create a PNG file, name it ‘screenshot.png’ and place it in the child theme folder. Your PNG file can be any photo or image; the recommended size is 1200 x 900 pixels.
That’s all set!
Leave a Reply