0

子主题中 .php 文件的更改不会应用于我的前端站点。

我已经从父“成长”激活了一个名为“成长儿童”的WordPress 儿童主题。

我想更改我网站上的页脚文本和链接,因此,按照说明,我已将footer.php文件(实际上名为 04.footer.php)从父目录复制到子主题文件夹。我进行了更正,但它们并未应用于我的网站。怎么了?

当我直接在父目录中进行相同的更正时,它们很好地应用于我的站点。

我在子主题的functions.php中使用了以下代码:

<?php
add_action( 'wp_enqueue_scripts', 'grow_child_enqueue_styles' );
function grow_child_enqueue_styles() {

    $parent_style = 'grow'; // This is 'grow-style' for the grow theme.

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'grow-child',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    );
}
?>

我想在我的子主题文件夹中更改父主题文件,以便在更新主题时不会丢失更改。

4

0 回答 0