我正在尝试反转基于我的测试位于
内的标题徽标标题的样式/wp-content/themes/<theme-name>/inc/partials.php
由于文件在Parent主题下,我需要在子主题目录
下复制此文件/wp-content/themes/<theme-name>-child/inc/partials.php
但是,我似乎无法在我的孩子主题上复制它。
例如,在父主题目录中,如果我反转以下代码块:
<h2 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h2>
更改会反映在主页的标题部分,但如果对子主题的文件版本应用了相同的更改,则不会反映任何更改。
我在父主题上看到了
partials.php
包含在
中的functions.php
根据以下代码段:
/** Standard Includes */
$includes = array(
'<other-files>.php',
'<other-files>.php,
'partials.php',
'<other-files>.php',
);
foreach ( $includes as $file ) {
require( get_template_directory() . '/inc/' . $file );
}
在
中复制此代码子主题目录上的的functions.php
不能使它工作。
我该怎么办?我错过了什么? TIA
答案 0 :(得分:0)
get_template_directory函数返回父主题路径。请查看参考链接。
在使用子主题的情况下,绝对路径 将返回父主题目录。使用 get_stylesheet_directory()获取子主题的绝对路径 。目录
您可以将Obs group replicate count_F count_M
1 1 A 3 2
2 1 B 4 2
3 1 C 4 5
4 2 A 5 4
5 2 B 6 3
6 2 C 2 2
7 3 A 5 1
8 3 B 3 4
9 3 C 3 1
功能更改为get_template_directory()
功能并将所有这些文件复制到您的子主题中,但不建议这样做,因为更新主题后您的修改会丢失。< / p>
我建议您与您的主题作者联系,并要求他们提供解决方案,将get_stylesheet_directory()
文件覆盖到您的子主题中。