• Resolved knutbecker

    (@knutbecker)


    Hi all,

    is it possible to change the order of the language when I hover the language switch? We want that the current selected language is always on top. Currently it’s always on the last position.

    Thank you in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there,

    ​Yes, you can change the order, but for that you will have to modify the code. Because of the way you asked this, I’ll consider that you are referring to the floating dropdown language switcher that’s floating at the bottom of the page.

    You can use FTP to find the code here: wp-content/plugins/translatepress/includes/class-language-switcher.php.
    I recommend you to copy the file on your computer before you proceed to make any changes to it (this way you will have a backup file in case things get messy).

    Here is an image with the changes you have to make: https://drive.google.com/file/d/1q_Dy46ApyL_N-Rjer0RVzAywoS5P-1vw/view?usp=sharing
    You need to add the line underlined with red and you also need to delete the line underline with white (you can also comment it the same way I did, this way you can go back and revert the change easily).

    The changes were made on the latest TranslatePress version (1.8.6.) so you might want to update to that before you change the code (this way the code will look the same as in the image).

    Let me know if this is the result that you wanted to obtain.

    Best regards,

    Thread Starter knutbecker

    (@knutbecker)

    Hi Cristian,

    thank you for your support! That’s what I needed. Have a nice day.

    Best regards

    Knut

    Hi Knut,

    I’m happy that this is what you wanted, but I forgot to mention something really important. Since this change was done to the language switcher php file, you will have to add those changes again whenever that file will be touched in a new update.
    It’s up to you to decide how much of an inconvenient it will be in the future.

    Best reagards,
    Cristian

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hover language switch – selected language on top’ is closed to new replies.