If you need the Child Theme for Akurai or Sikika, you can find the download links at the bottom of this page.
WordPress gives as an option to create child themes - sort of sub themes - which inherit styles and functionalities from parent theme, all of parent theme functions are accessible within a child theme. Using child themes allows us to make modifications to any aspect of the parent theme, keep them separate and organized, and this, in its turn, lets us upgrade the parent theme without affecting our custom modifications.
Child theme files are stored in a separate directory in the themes
directory. For example, if we're creating a child theme for Akurai theme, the in our themes
directory we'd need to create a new directory called akurai-child
.
themes/
akurai/
akurai-child/
Creating a WordPress Child Theme
Every child theme must contain 2 required files: style.css
and functions.php
. You can add other additional files as well, which you'll usually do, however these 2 are required in order the theme to work properly.
1. style.css
Every WordPress website/theme requires a style.css
file where usually all the theme styles are stored. Here's how it may look like for Akurai Child Theme:
/*
Theme Name: Akurai Child
Theme URI: https://dinomatic.com/akurai
Author: DinoMatic
Author URI: https://dinomatic.com
Template: akurai
Description: Akurai: Child Theme
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: akurai-child
*/
If it's not a child theme for Akurai, you'll need to update the comment block. Replace Akurai/akurai with your theme name, also edit the Author lines. After the comment block, you can add your custom style definitions and they'll be loaded into your website.
TIP: If you have more than just a couple of lines of styles, organize them in some way, let's say about page
styles separate from contact page
styles; and you may want to add a comment block on top of each section as well. Long manually added styles can get messy very quickly.
NOTE: If you're creating a child theme only to add custom styles, you can use the WP Customizer -> Custom CSS for that.
2. functions.php
Another required file is the functions.php
where you define the theme functions. This is the example for Akurai Child Theme:
<?php
/**
* Akurai Child Theme functions and definitions.
*
* @package akurai-child
*/
/**
* Enqueue parent theme styles.
*/
function akurai_child_enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'akurai_child_enqueue_parent_styles' );
The akurai_child_enqueue_parent_styles
function is there to load the parent theme styles. After that you can add your own custom functions.
TIP: If you're adding custom functions, make sure to format them well, use descriptive function and variable names, also add a comment block on top of it in order later to be able to know what a specific piece of code does.
3. screenshot.png
This is optional, but I like to upload a screenshot to have a nicer view in my WP Dashboard Themes Page. The filename should be screenshot.png
and the dimensions: 1200 x 900 pixels.
Using the Child Theme
Once all the files are ready, store them in a folder and upload to your themes
directory. In your WordPress dashboard navigate to Themes and, if everything was done correctly, the new child theme will be available there. Select and activate it and that's all!