How does a Genesis child theme understand that the Genesis theme is the parent theme?

In most Genesis child themes, the following line of code exists: Starts the engine.require_once get_template_director

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?

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?

Share Improve this question asked Aug 21, 2019 at 10:07 mohitbmohitb 31 bronze badge 1
  • Is there any reason you think it's anything other than the way any other child theme works? developer.wordpress/themes/advanced-topics/child-themes – Jacob Peattie Commented Aug 21, 2019 at 10:09
Add a comment  | 

2 Answers 2

Reset to default 1

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.

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745195183a4616054.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信