如何在 Wordpress 子主题中加入第二个样式表?

How to enqueue second stylesheet in Wordpress child theme?

我正在使用子主题,需要将滑块的样式表加入队列。 css 文件位于父主题目录的文件夹中,即 /parent-theme/css/flexislider.css

我使用一个插件创建了子主题,该插件使用以下代码将 functions.php 文件添加到子主题目录:

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

我想我必须在上面的函数中添加另一个引用 flexislider.css 的条目,但我不太确定该怎么做。

*已更新

根据您添加到问题中的内容,您应该能够只添加到该函数并注册样式表。完整的函数如下所示:

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')
);
wp_enqueue_style('flex-slider',get_template_directory_uri() . '/css/flexislider.css');
}

我对子主题没有太多经验,但是按照该函数中的模型,我认为 get_template_directory 指向父主题而不是子主题,您说的 flexislider 代码是位于