如何仅在 RTL 模式下加载我的 Wordpress 模板中的特定样式表
How to load a specific Stylesheet in my Wordpress template only when in RTL mode
我在 WordPress 中有一个 Bootstrap3 内置主题,我正在努力将主题从 LTR 翻译和转换为 RTL。
所以我只想在我的 Wordpress 主题上以 RTL 模式加载此样式表 https://cdnjs.cloudflare.com/ajax/libs/bootstrap-rtl/3.2.0-rc2/css/bootstrap-rtl.min.css
。我该怎么做?
您可以在主题中使用 is_rtl():
if ( is_rtl() ) {
wp_enqueue_style( 'style-rtl', 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-rtl/3.2.0-rc2/css/bootstrap-rtl.min.css' );
}
我在 WordPress 中有一个 Bootstrap3 内置主题,我正在努力将主题从 LTR 翻译和转换为 RTL。
所以我只想在我的 Wordpress 主题上以 RTL 模式加载此样式表 https://cdnjs.cloudflare.com/ajax/libs/bootstrap-rtl/3.2.0-rc2/css/bootstrap-rtl.min.css
。我该怎么做?
您可以在主题中使用 is_rtl():
if ( is_rtl() ) {
wp_enqueue_style( 'style-rtl', 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-rtl/3.2.0-rc2/css/bootstrap-rtl.min.css' );
}