【发布时间】:2017-10-14 19:17:50
【问题描述】:
我正在组合一个基于父主题的 wordpress 子主题,该父主题在其目录中有多个样式表。例如,这是一些样式表的导航:
- 父主题/style.css
- 父主题/css/style.css
- 父主题/css/bootstrap.css
我创建了我的子文件夹并创建了我的 style.css 文件以及我的 function.php 文件,但似乎子主题只是为 parent-theme/style.css 文件提取样式表,而不是全部提取.css 文件。
经过一番挖掘,这是我的 functions.php 文件当前所在的位置:
<?php
/* v1.0.5
Date: 5/15/17
*/
function my_theme_enqueue_styles() {
$parent_style = 'wizard-style'; // This is 'wizard' for the Wizard theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . 'style.css' );
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/css/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' );
?>
我的主要目标是让子主题提取所有需要的样式表,并利用我的子主题文件夹 (child-theme/style.css) 下的一个样式表来进行我想做的任何更改。
我的问题是:
- 这可能吗?
- 如果可能,可能会发生哪些错误导致我的 fucntion.php 文件无法提取所有样式表?
- 如果不可能,我需要对我的 function.php 文件和目录进行哪些更改才能使其正常工作?
【问题讨论】:
标签: php css wordpress parent-child