A child theme allows you to modify DigiFusion without losing your changes when the theme updates. The child theme inherits all functionality from the parent theme while allowing you to override specific files and add custom code.
Creating the Child Theme Directory
Create a new folder in your WordPress themes directory. Name it digifusion-child
or any name that clearly identifies it as a child theme.
/wp-content/themes/digifusion-child/
Required Files
style.css
Create a style.css
file in your child theme directory with the following header:
/*
Theme Name: DigiFusion Child
Description: Child theme of DigiFusion
Author: Your Name
Template: digifusion
Version: 1.0.0
*/
/* Your custom styles go here */
The Template
line must match the parent theme’s directory name exactly.
functions.php
Create a functions.php
file to properly enqueue the parent theme’s styles:
<?php
/**
* DigiFusion Child Theme functions
*/
// Prevent direct access
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Enqueue parent and child theme styles
*/
function digifusion_child_enqueue_styles() {
// Enqueue parent theme stylesheet
wp_enqueue_style(
'digifusion-parent-style',
get_template_directory_uri() . '/style.css',
array(),
wp_get_theme()->parent()->get('Version')
);
// Enqueue child theme stylesheet
wp_enqueue_style(
'digifusion-child-style',
get_stylesheet_directory_uri() . '/style.css',
array( 'digifusion-parent-style' ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'digifusion_child_enqueue_styles' );
Activating the Child Theme
- Upload the child theme folder to
/wp-content/themes/
- Go to Appearance > Themes in your WordPress admin
- Activate the “DigiFusion Child” theme
Overriding Template Files
To customize template files, copy them from the parent theme to your child theme and modify as needed:
Parent: /wp-content/themes/digifusion/single.php
Child: /wp-content/themes/digifusion-child/single.php
Adding Custom Functions
Add your custom functions to the child theme’s functions.php
file:
/**
* Custom function example
*/
function digifusion_child_custom_function() {
// Your custom code here
}
add_action( 'wp_head', 'digifusion_child_custom_function' );
Inheriting Customizer Settings
Child themes automatically inherit Customizer settings from the parent theme. No additional configuration is required.
The child theme structure is now complete and ready for customization. All parent theme functionality remains intact while allowing safe modifications.