繁体   English   中英

Wordpress中的子主题目录

[英]Child theme directory in wordpress

我是在wordpress中制作儿童主题的新手,我的childtheme存在问题。 如果将footer.php放在父主题的其他目录中,如何更改子主题中的footer.php。 在这里,父主题将footer.php放在hooks-> footer.php父主题footer目录下: 父主题目录

这是我的子主题,我想在其中更改子主题目录的页脚吗? 子主题目录

这是我的孩子主题functions.php:

<?php
//
// Recommended way to include parent theme styles.
//  (Please see http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme)
//  
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array('parent-style')
    );
}
//
// Your code goes below
//

绑定父主题和子主题的正确方法是使用wp_enqueue_scripts操作,并在子主题的functions.php中使用wp_enqueue_style(),如下所示。

    <?php
    function my_theme_enqueue_styles() {

       $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for     the Twenty Thirteen theme.

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

http://www.codextutor.com/creating-child-theme-in-wordpress/中查看更多详细信息

希望对您有帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM