How to create a child theme for Hestia
If you use Hestia or Hestia Pro and make changes to the theme, those changes are likely to be overwritten at the next theme update. To prevent that, create a child theme. This guide shows two ways to do it.
In this article
Method 1: Quicker using WP-admin
This method packages all the steps of Method 2 into a ready-made theme zip file.
- Download the child theme for your theme:
- Install it just like any other theme and activate it.
Method 2: Using FTP
📝 Note: Make sure you have FTP access to your site.
Log in to your website using an FTP client, such as FileZilla, and navigate to the
wp-content/themes/directory. This is the directory where all your themes are stored.Create a new folder for your child theme. You can give it any name.
Important: This example creates a child theme of Hestia Pro, so the folder is named hestia-pro-child. Name the child theme folder hestia-pro-child for Hestia PRO and hestia-child for Hestia, so that you can migrate the options from the child theme to the parent theme if you want to switch back at some point.
Inside that folder, create a style.css file and add the following code to it:
/*
Theme Name: Hestia Pro Child
Theme URI: https://www.themeisle.com/
Description: This is a custom child theme I have created.
Author: Themeisle
URI: https://www.themeisle.com/
Template: hestia-pro
Version: 0.1
*/📝 Note: If you are creating a child theme for Hestia, replace "Template: hestia-pro" with "Template: hestia".
- Load the stylesheet of the parent theme: create a file named functions.php in the child theme folder and add the following code:
<?php
if ( !defined( 'ABSPATH' ) ) exit;
if ( !function_exists( 'hestia_child_parent_css' ) ):
function hestia_child_parent_css() {
wp_enqueue_style( 'hestia_child_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( 'bootstrap' ) );
}
endif;
add_action( 'wp_enqueue_scripts', 'hestia_child_parent_css', 10 );
/**
* Import options from the parent theme
*
*/
function hestia_child_get_parent_options() {
$hestia_mods = get_option( 'theme_mods_hestia-pro' );
if ( ! empty( $hestia_mods ) ) {
foreach ( $hestia_mods as $hestia_mod_k => $hestia_mod_v ) {
set_theme_mod( $hestia_mod_k, $hestia_mod_v );
}
}
}
add_action( 'after_switch_theme', 'hestia_child_get_parent_options' );📝 Note: If you are creating a child theme for Hestia, replace "theme_mods_hestia-pro" with "theme_mods_hestia".
- Save all changes.
Troubleshooting
- If activating your child theme causes a critical error or site crash, see How to Fix Hestia Child Theme Causes a Critical Error or Site Crash.
