Viewing 1 replies (of 1 total)
  • Hello @evo252 and @loyukfai,

    If you want to change the look of the language switcher to make it simple and light, there are a few ways you can achieve this.

    1. Modifying CSS: You can add additional CSS rules to either the Floating language switcher or the Shortcode language switcher to customize its appearance. You can target specific CSS classes or IDs associated with the language switcher and apply your desired styling.
    2. Creating a custom language switcher: If you’re looking for more radical changes. The language switcher consists of anchor tags with href attributes pointing to the equivalent page in different languages. You can use the code snippet below as a starting point:
    <?php $array = trp_custom_language_switcher();  ?>
    
    <!-- IMPORTANT! You need to have data-no-translation on the wrapper with the links or TranslatePress will automatically translate them in a secondary language. -->    
    
    <ul data-no-translation>
        <?php foreach ($array as $name => $item){ ?>
                <li style="list-style-image: url(<?php echo $item['flag_link'] ?>)"> 
                    <a href="<?php echo $item['current_page_url']?>"> 
                        <span><?php echo $item['short_language_name']. ':' . $item['language_name']?>
                        </span>
                    </a>
                </li>
        <?php } ?>
    </ul>

    By customizing the HTML structure and adding your own CSS, you can create a language switcher that suits your desired design.

    You can read more about this here:
    https://translatepress.com/docs/developers/custom-language-switcher/

    I hope this helps you achieve the desired look for your language switcher. If you have any further questions, feel free to ask.

    Best regards,

Viewing 1 replies (of 1 total)
  • The topic ‘Customize the style of Language Switcher?’ is closed to new replies.