[英]Child theme directory in wordpress
I am new in making child theme in wordpress, i have a problem about my childtheme. 我是在wordpress中制作儿童主题的新手,我的childtheme存在问题。 How can i change the footer.php in child theme if it was being placed in other directory in my parent theme.
如果将footer.php放在父主题的其他目录中,如何更改子主题中的footer.php。 Here it is, the parent theme puts the footer.php under hooks->footer.php Parent Theme footer directory :
在这里,父主题将footer.php放在hooks-> footer.php父主题footer目录下:
Here is my child theme where i want to change the footer the directory of my child theme ? 这是我的子主题,我想在其中更改子主题目录的页脚吗? :
:
here is my child theme functions.php : 这是我的孩子主题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
//
The correct method for binding Parent and child theme is using wp_enqueue_scripts action and use wp_enqueue_style() in your child theme's functions.php as shown 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' );
?>
Check More details in http://www.codextutor.com/creating-child-theme-in-wordpress/ 在http://www.codextutor.com/creating-child-theme-in-wordpress/中查看更多详细信息
Hope it will help you. 希望对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.