If you wish to design a custom TranslatePress language switcher, there is a function you can implement to help you with all the necessary information when using the plugin.
Create a TranslatePress Custom Language Switcher
The function that needs to be called is
The function returns an array with the following parameters:
$custom_ls_array[$language_code]['language_name']– the full language name
$custom_ls_array[$anguage_code]['language_code']– the language code of the respective language
$custom_ls_array[$anguage_code]['short_language_name']– the language code of the language, the slug which will be used in the url
$custom_ls_array[$anguage_code]['flag_link']– a link to the flag of the respective language
$custom_ls_array[$anguage_code]['current_page_url']– the URL of the current language with the language slug added
Here is an example of a custom-made language switcher:
While here you can see the code snippet:
You can also create a custom language switcher shortcode that you can then use like [[custom-langauge-switcher]]
If you just need to quickly create a classic language switcher, check out TranslatePress’ default language switcher settings.