我在wordpress中使用Woffice主题,我激活了woffice子主题,现在我想重写父主题文件。这是父主题文件夹目录。
/wp-content/themes/woffice/buddypress/members/index.php我想在子主题中对index.php进行更改,我像这样粘贴文件夹以覆盖
/wp-content/themes/woffice-child-theme/buddypress/members/index.php但它不能覆盖。如果有别的办法,请帮助我。
发布于 2018-09-28 13:41:02
只支持Wordpress子主题覆盖模板。在Wordpress中,主题由一堆用作模板的PHP文件组成。您可以在模板层次结构中找到这些文件的列表。
https://developer.wordpress.org/themes/basics/template-hierarchy/
发布于 2018-09-28 13:58:14
儿童主题的整个故事是:
总之,子主题必须调用父主题。
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>在其function.php中
并有新的PHP模板文件来覆盖父级的模板文件(两者必须具有相同的名称)。如果在子文件中存在一个模板文件,则WP将使用此文件。
但另一方面,也有一些像下面这样的初始主题,为开发提供了基础:
https://underscores.me/ (由Wordpress peolpe创建)
http://jointswp.com/ (基金会框架)
https://understrap.com/ (引导带4)
https://stackoverflow.com/questions/52555898
复制相似问题