[英]Wordpress child theme - Overriding a php file which is not in the root folder of a theme
我想通過子主題修改Shop Isle主題(Wordpress)的“ / inc / sections”文件夾中的php文件。 我嘗試通過創建子主題中具有相同名稱的新php文件來嘗試經典方式,但是它不起作用。 我已經讀過一種方法可以使子文件覆蓋父文件。
我嘗試過的所有方法都不起作用,或者像下面的這段代碼一樣會產生一些錯誤(滾動問題,空白等):
<?php
require get_stylesheet_directory() . '/inc/sections/shop_isle_big_title_section.php' ;
?>
您知道解決方案嗎?
front-page.php代碼:
/* Wrapper start */
echo '<div class="main">';
$big_title = get_template_directory() . '/inc/sections/shop_isle_big_title_section.php';
load_template( apply_filters( 'shop-isle-subheader', $big_title ) );
好的,現在正在工作!!!
我只需要在子主題中創建一個新的front-page.php並將get_template_directory的“模板”替換為“樣式表”即可。
謝謝你的幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.