Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author John Clause

    (@johnclause)

    I think there must be WP filters to alter the list of body classes. Search their documentation. Use get_locale() to determine the current language.

    Does it answer what you meant?

    Thread Starter ofmarconi

    (@ofmarconi)

    I found it in my head:

    <body <?php body_class(“”); ?>>

    What I put in body_class(” HERE “)?

    A function? What function would print EN if in English or RU when in Russian?

    Tks

    Plugin Author John Clause

    (@johnclause)

    The documentation is here https://codex.ww.wp.xz.cn/Function_Reference/body_class, have you seen it?

    It is up to you how to do it, for example, something like this:

    <?php
    $myclasses = '';
    $lc = get_locale();
    switch($lc){
      case 'ru_RU': $myclasses = 'RU'; break;
      case 'en_US': $myclasses = 'EN'; break;
    }
    body_class($myclasses);
    ?>

    Locales in cases should match those that are set in the language properties.

    Thread Starter ofmarconi

    (@ofmarconi)

    sorry, i’m noob. :/

    add_filter( ‘body_class’, function( $classes ) {
    return array_merge( $classes, array( ‘lang-‘ . qtrans_getLanguage() ) );
    } );

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

The topic ‘BODY CLASS for each language’ is closed to new replies.