在主题中,将样式表按如下方式排列:
add_action( \'wp_enqueue_scripts\', \'t5_enqueue_style\' );
function t5_enqueue_style()
{
wp_enqueue_style(
\'theme-name-default\',
get_template_directory_uri() . \'/css/default.min.css\'
);
}
额外的RTL样式表也在此处排队,将默认值列为依赖项:
if ( is_rtl() )
{
wp_enqueue_style(
\'theme-name-rtl\',
get_template_directory_uri() . \'/css/rtl.min.css\',
array ( \'theme-name-default\' )
);
}
因此,完整的代码是:
add_action( \'wp_enqueue_scripts\', \'t5_enqueue_style\' );
function t5_enqueue_style()
{
wp_enqueue_style(
\'theme-name-default\',
get_template_directory_uri() . \'/css/default.min.css\'
);
// extra RTL stylesheet
if ( is_rtl() )
{
wp_enqueue_style(
\'theme-name-rtl\',
get_template_directory_uri() . \'/css/rtl.min.css\',
array ( \'theme-name-default\' )
);
}
}