April 24th, 2020 at 11:01 #101833
What is the proper way of creating a child theme for the kahuna theme?
I tried the official guide with a basic functions.php and style.css and it seems OK, but if I try to go deeper, like include core.php, it completely messes up the website.
So, is there a correct way of creating a child theme for kahuna?
ThanksApril 27th, 2020 at 15:32 #101992ZedCryout Creations Team
Customizing the theme’s functionality can be done in multiple ways, depending on what bit of code you’re actually looking to extend/replace.
WordPress has a long list of files that are automatically recognized and get used with priority if they are present in the child theme’s folder. Beside the templates listed there, it will automatically used any files preset in the content/ subfolder if they have the same name as those also found in the parent theme.
Beyond these, you wouldn’t be able to replace other theme files (especially php) by simply duplicating them in the child theme. For the functionality found in the rest of the code you’ll need to apply different approaches, depending on the code in question:
– pluggable functions (those wrapped in if (function_exists('function_name')) calls) can be copied over to the child theme (in the functions.php file or any other file that’s included/loaded by it) and customized there.
– the rest of the function calls are usually hooked in place (using either filters or actions); to customize those functions’ code you’ll have to unhook the original calls, copy and rename the functions to the child theme and hook back the replacement.
Styles and scripts are also enqueued using WordPress’ core calls, so replacing theme would be done de-enqueuing the original and enqueueing the replacement in place.
The topic ‘correct child theme?’ is closed to new replies.