我试图用子主题修改wordpress主题。我的父主题在其functions.php中具有以下功能:
require_once(get_template_directory() . "/includes/theme-styles.php");我想将它更改为包含我自己的样式表:类似于:
require_once(get_template_directory() . "../child-theme/includes/theme-styles.php");我可以在我的子主题的functions.php中包含这个函数,但是由于子主题的functions.php是先加载的,所以我看不出有什么方法可以覆盖/阻止调用父主题的require_once()。有没有办法这样做,或可能的解决办法?谢谢
发布于 2016-01-26 04:09:49
您可以使用get_stylesheet_directory()引用您的子主题,然后您可以指向您的文件。
require_once( get_stylesheet_directory() . '/includes/theme-styles.php' );它将加载您的文件并替换父主题文件。
https://wordpress.stackexchange.com/questions/175489
复制相似问题