admin管理员组文章数量:1390192
I tested my website with / plugin when wordpress language is english.It seemed good.So Do I still need to make style-rtl.css? If I need to make it, how can make and enqueue two rtl css because I have 2 theme css files? Thank you
I tested my website with https://wordpress/plugins/rtl-tester/ plugin when wordpress language is english.It seemed good.So Do I still need to make style-rtl.css? If I need to make it, how can make and enqueue two rtl css because I have 2 theme css files? Thank you
Share Improve this question asked Mar 13, 2020 at 14:13 ahmet kayaahmet kaya 331 silver badge9 bronze badges1 Answer
Reset to default 0When using a CSS creator tool, you’ll have to enqueue this style-rtl.css so WordPress knows when to load this version. All you need to do is add a snippet to the functions.php file. This allows WordPress to load the right stylesheet when it is set to RTL language. Simply add the wp_style_add_data() information to your existing enqueued styles function. If you are using a devoted override stylesheet the no special functions are needed.
you have already enqueued the style, wp_style_add_data() does not enqueue, it adds meta data to an already enqueued style and this function does not allow for empty parameters. see below.
if (is_page_template('page-templates/full-page.php')) {
wp_enqueue_style( 'lucieaverillphotography_style', get_stylesheet_uri() );
wp_enqueue_style( 'lucieaverillphotography-full-page', get_stylesheet_directory_uri() . '/css/full-page.css', array( 'lucieaverillphotography_style' ) );
//wp_style_add_data( 'lucieaverillphotography-full-page' ); --> not needed & cannot be used without required inputs
}
But.....you could combine all your css into a single file and call this as default on all pages (call ie8 specific stylesheets if you want....), this way it can be browser cached and after the 1st visit, your css loads faster...Brush up on CSS specificity and ids/ classes, it will save you a lot of work in the long run!
If you want template specific changes to css you have a couple of options
if the css changes are in the article/ page, there will be usually a id/class set unique to that page (or add one yourself).
add custom css directly to the template (it works anywhere in the page, wont be popular with standards but for the moment you can put css rules anywhere inside style tags
Add a custom class into your header for the body tag, e.g. >
You can then specifically target css in your template... e.g.
page-id-2 header{ display: none;} //-->use chrome inspector to see what classes are outputted on each template
本文标签: multi languageHow to enqueue 2 rtl css
版权声明:本文标题:multi language - How to enqueue 2 rtl css 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744671682a2618862.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论