• Resolved sin.sfx

    (@sinsfx)


    HI,
    first of all the plugin rocks!
    I have two questions :

    • Any solution to create an rtl.css from polylang ?
      my second language needs one specific style (rtl.css)
      im using theme folder but dosent soffer the rtl.css
    • im using a widget text, the title can be translated but i can’t find how to translate the content

    Thank you

    https://ww.wp.xz.cn/plugins/polylang/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    Polylang cannot help you with rtl.css. Everything’s on the theme side. If you don’t know how to do, I suggest that you choose a rtl ready theme.

    For widget text, the easier is to add one widget per language and then use the languages filter (should be the last option of your widget).

    Thread Starter sin.sfx

    (@sinsfx)

    HI,
    Unfortunately i can’t change the actual theme, i’ll try the solution of conditional css within the header, maybe it’s the only solution.
    (i suggeste it for the next update of the plugin it will be helpful for us )
    For the widget text thx it solved my problem.
    Other question im using the moodle course list widget, the title is translated well but not the form’s login, any suggestion or solution to translate those input elements ?
    Thank you Chouby.

    Plugin Author Chouby

    (@chouby)

    Hi!

    If your theme is well written, you should have no need to modify your header, as Polylang will output correct language information in html (if your theme comes with relevant hooks).

    So normally, if you add a rtl.css file in your theme, this file will be automatically loaded and used for rtl languages.

    See: https://codex.ww.wp.xz.cn/Right-to-Left_Language_Support

    Thread Starter sin.sfx

    (@sinsfx)

    HI Chouby,
    I Tried that, but the file (rtl.css) is always loaded for both languages.

    here is what i did :

    i declared in functions.php

    wp_enqueue_style(‘rtl’, CSSPATH . ‘rtl.css’);

    i created the file rtl.css at css folder of the theme

    (i tried also without declaration in functions.php, just created the rtl.css but didn’t loaded )

    i missed something maybe ?

    Thank you

    Plugin Author Chouby

    (@chouby)

    Hi!

    You don’t need to do that. Everything is managed by WordPress + Polylang. Just create your file rtl.css, put it in your theme directory and that’s all.

    Thread Starter sin.sfx

    (@sinsfx)

    Morning,
    I tried that, but the rtl.css didn’t loaded !
    i found a solution to load it, i used condition with is_rtl()

    if ( is_rtl() ) {
    wp_enqueue_style(‘rtl’, CSSPATH . ‘rtl.css’);
    }

    Im still confused, how to do it on the right way ?

    Thanks again Chouby

    Plugin Author Chouby

    (@chouby)

    Where did you put your rtl.css file? From the function get_locale_stylesheet_uri() found in wp-includes/theme.php, I see that WordPress expects it in the root directory of your theme (where you already have your style.css). The filter ‘locale_stylesheet_uri’ allows you to change the location.

    But if you found a working way, just keep it.

    Thread Starter sin.sfx

    (@sinsfx)

    HI,
    same directory as all others css.
    here is the declaration for path

    define(‘CSSPATH’, get_template_directory_uri() . “/css/”);

    and

    function load_js_scripts() {
    if ( !is_admin() ) {

    // CSS
    wp_enqueue_style(‘general-styles’, CSSPATH . ‘style.css’);
    wp_enqueue_style(‘superfish’, CSSPATH . ‘superfish.css’);
    wp_enqueue_style(‘tweet’, CSSPATH . ‘jquery.tweet.css’);
    wp_enqueue_style(‘flexslider’, CSSPATH . ‘flexslider.css’);
    wp_enqueue_style(‘lofslider’, CSSPATH . ‘lof-slider.css’);
    wp_enqueue_style(‘tip-twitter’, JSPATH . ‘poshytip-1.1/src/tip-twitter/tip-twitter.css’);
    wp_enqueue_style(‘tip-twitter-yellow’, JSPATH . ‘poshytip-1.1/src/tip-yellowsimple/tip-yellowsimple.css’);
    wp_enqueue_style(‘prettyPhoto’, JSPATH . ‘prettyPhoto/css/prettyPhoto.css’);
    wp_enqueue_style(‘skin’, CSSPATH . ‘skin.css’);
    wp_enqueue_style(‘lessframework’, CSSPATH . ‘lessframework.css’);
    //code mine
    if ( is_rtl() ) {
    wp_enqueue_style(‘rtl’, CSSPATH . ‘rtl.css’);
    }
    }

    Plugin Author Chouby

    (@chouby)

    Hi!

    Yes. What you did is fine. But you can also put your rtl.css directly in the theme directory and not in the css directory. Thus it should work even without the code you added.

    NB: You should do this in a child theme rather than modifying your theme.

    Thread Starter sin.sfx

    (@sinsfx)

    HI,
    Tried directly in the theme folder, and yes, works !

    Chouby, my Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘specific style css ( rtl.css)’ is closed to new replies.