【发布时间】:2020-09-16 03:34:59
【问题描述】:
由于某种原因,我的子主题模板无法识别。
我相信我遵循了正确的程序(并检查了缓存等)
/wp-content/themes/divi-child/includes/builder/module/Blog.php
应该替换
/wp-content/themes/Divi/includes/builder/module/Blog.php
(相同的路径和相同的文件,略有更新)
子主题模块模板无法识别(更改子主题模板无效)
我已经测试过编辑主文件,并且每次都可以立即使用 时间。
非常感谢任何建议。
干杯
编辑
根据 Divi,以下内容应该可以工作,但是当我尝试时它会破坏网站。
显然,仅仅将模块复制到子主题中是不够的。该文件需要复制。然后将文件复制到 child-theme/custom-modules/Blog.php。在functions.php文件底部添加以下代码后:
function divi_custom_blog_module() {
get_template_part( '/custom-modules/Blog' );
$myblog = new custom_ET_Builder_Module_Blog();
remove_shortcode( 'et_pb_blog' );
add_shortcode( 'et_pb_blog', array( $myblog, '_render' ) );
}
add_action( 'et_builder_ready', 'divi_custom_blog_module' );
【问题讨论】:
-
我明白了,在指南中 - 他们说你需要把你的博客模板文件放到:/wp-content/themes/divi-child/custom-modules/。稍后将代码添加到您的子主题的functions.php 文件的底部。那是你做的吗?
标签: php wordpress wordpress-theming divi