0

In most Genesis child themes, the following line of code exists:

// Starts the engine.
require_once get_template_directory() . '/lib/init.php';

I understand that this includes the init.php file from the lib directory within the Genesis parent theme folder.

My question is simply - why does get_template_directory() return the Genesis parent folder, as opposed to the child theme folder? And how does it identify it if there are multiple parent themes possible?

0

I'm not experienced with Genesis, specifically, but I imagine its child themes work the same as child themes for any other theme. As documented, a child theme is created by adding a Template: line to the style.css header, which is the directory name of the parent theme:

/*
 Theme Name: Genesis Child Theme
 Template: genesis
*/

By defining the "Template" for a theme, WordPress functions like get_template_directory() know to use that theme's directory for the path or URL.

0

There is no multiple parent theme possible. Because you specify parent theme by Template: genesis. This helps WordPress to find parent theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.