• I am author of a plugin which creates a file called bspstyle.css and it is enqueued as per standard.

    I need to create a small css for rtl sites.

    I have read that for a theme the style.css has a rtl.css that does the rtl stuff.

    2 questions :

    1. How do I get my plugin to have an rtl version and how do I make it enqueued correctly?

    currently I enqueue as follows :

    wp_register_style('bsp', plugins_url('css/bspstyle.css',dirname(__FILE__) ), array( 'bbp-default' ));
    wp_enqueue_style( 'bsp');

    as part of a function that is called by

    add_action('wp_enqueue_scripts', 'bsp_enqueue_css');

    Do I have to enqueue a new file, or is there a plugin version of an rtl.css file?

    2. Does the rtl replace the original bspstyle.css for rtl sites, or does it fire after?

    ie do I have to repeat all the css, or just have the changes needed for rtl sites in my alternate css file?

    Thanks for your help in advance

    • This topic was modified 7 years, 11 months ago by Robin W.
    • This topic was modified 7 years, 11 months ago by Robin W.
    • This topic was modified 7 years, 11 months ago by Robin W.
    • This topic was modified 7 years, 11 months ago by Robin W.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The style loader doesn’t look for any plugin stylesheets at all, that’s why you have to enqueue yours. Thus you need to enqueue your RTL file as well. You can use the is_rtl() function to conditionally enqueue your file. Be sure to specify your main stylesheet as a dependency so that rtl.css is always loaded after the main one. Thus rtl.css only needs to contain overriding rules, the other rules from the main stylesheet will still apply.

    • This reply was modified 7 years, 11 months ago by bcworkz. Reason: typo
Viewing 1 replies (of 1 total)
  • The topic ‘How do I create rtl.css in my plugin’ is closed to new replies.