How to create a child theme for Hestia
If you are using Hestia or Hestia Pro and want to make some changes in the theme, those changes are likely to be overwritten at the next update of the theme. In order to prevent that from happening, we recommend you create a child theme. Next, you will find the instructions on how to create a child theme for Hestia.
Method 1: Quicker using WP-admin
Install it just like any other theme and activate it.
Method 2: Using FTP
/* 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, you would need to replace "Template: hestia-pro" with "Template: hestia".
Now, we need to 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' ) ); if( is_rtl() ) { wp_enqueue_style( 'hestia_child_parent_rtl', trailingslashit( get_template_directory_uri() ) . 'style-rtl.css', array( 'bootstrap' ) ); } } endif; add_action( 'wp_enqueue_scripts', 'hestia_child_parent_css', 10 ); /** * Import options from the parent theme * * @since 1.0.0 */ 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, you would need to replace "theme_mods_hestia-pro" with "theme_mods_hestia".
That's all. Save all changes.