This thread is resolved. Here is a description of the problem and solution.
Problem:
The client is building a website and wants to display two different language switchers in different formats: one with language codes (EN | FR | DE) and another with full language names (English | French | German).
Solution:
We recommend using PHP actions to output custom language switchers in different formats. For the language codes, you can add a function to your theme's functions.php file and call it wherever you need it. Here's an example code snippet to display language codes:
function test_ls() { global $sitepress; $testls = $sitepress->get_ls_languages(); foreach ( $testls as $lng ) { echo("<a href=" . $lng["url"] . ">" . strtoupper( $lng['code'] ) . "</a>"); echo ("|"); } } test_ls();
For full language names, you can use the existing options in WPML -> Languages to create one language switcher and style it as needed. For more information on customizing language switchers, you can refer to the following documentation:
Please note that custom coding is beyond the scope of our support. For further assistance, you can refer to the WPML hooks documentation:
If this solution doesn't look relevant, please open a new support ticket.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 4 replies, has 3 voices.
Last updated by 1 year, 7 months ago.
Assisted by: Waqas Bin Hasan.