Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
对于WordPress子主题,我们应该在functions.php中指定哪些代码?_Php_Wordpress - Fatal编程技术网

对于WordPress子主题,我们应该在functions.php中指定哪些代码?

对于WordPress子主题,我们应该在functions.php中指定哪些代码?,php,wordpress,Php,Wordpress,我是按照这个例子在 但后来他们有了这条线 其中,父样式与父主题注册其样式表时在父主题中使用的$handle相同 这到底是什么意思 我正在为Bazaar Lite创建一个子主题,目录名为Bazaar Lite 我应该如何修改我的文件?实际上在文档中看起来有点打字错误。如果你看一看上面这个简单的例子,他们实际上使用了父样式。您仍然可以使用父样式,没有问题 为了回答您的问题,您应该能够使用原样显示的代码,而无需任何修改 希望这有帮助 <?php function my_theme_enqueue

我是按照这个例子在

但后来他们有了这条线

其中,父样式与父主题注册其样式表时在父主题中使用的$handle相同

这到底是什么意思

我正在为Bazaar Lite创建一个子主题,目录名为Bazaar Lite


我应该如何修改我的文件?

实际上在文档中看起来有点打字错误。如果你看一看上面这个简单的例子,他们实际上使用了父样式。您仍然可以使用父样式,没有问题

为了回答您的问题,您应该能够使用原样显示的代码,而无需任何修改

希望这有帮助

<?php
function my_theme_enqueue_styles() {

    $parent_style = 'parent-style';

    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' );
?>