Plugin Author
sbouey
(@sbouey)
Hi, the easier way for that is probably by shortcode , look in the documenation and use
[falangsw display_name="1" display_flags="0" ]
and put EN or DE in your language name
Thread Starter
nadine
(@ninablue)
Thank you for your fast reply @sbouey. I changed the language names to the language codes. Anyway, I would prefer an option in the language switcher to only display language codes instead of language names.
There is one other topic. My client wants to have a separation between the languages in the language switcher, such as EN | DE | FR . I manually added the “|” with JavaScript as single list items between the language names. I was just wondering if there is a cleaner way to achieve this? Perhaps for this goal the filter would be useful. Still curious about how it’s supposed to work. Can you give further explanation?
Plugin Author
sbouey
(@sbouey)
Hi,
In your case custom code is better , i use this on my Falang for Divi Demo site
function et_header_top_hook_falang() {
add_action('print_custom_language_switch', 'custom_language_switch', 10, 2);
do_action('falang_print_language_switch');
}
function custom_language_switch($languages, $falang) {
//test
?>
<ul class="falang-language-switcher nav">
<?php
foreach ($languages as $language) {
$file = FALANG_DIR.'/flags/' . $language->flag_code . '.png';
if ( ! empty( $language->flag_code ) && file_exists( $file) ) {
$flag_url = plugins_url( 'flags/'.$language->flag_code . '.png', FALANG_FILE );
}
?>
<li class="<?php echo $language->slug; ?><?php if ($falang->is_default($language)) echo ' current'; ?>">
<a href="<?php echo $falang->get_translated_url($language); ?>"><img src="<?php echo $flag_url; ?>" alt="<?php echo $language->name;?>"/> </a>
</li>
<?php } ?>
</ul>
<?php
}
you can remove the flag code and use the code (slug) and your | in the loop
Thread Starter
nadine
(@ninablue)
Here too. I forgot to mark this topic as resolved. I made some customizations to the filter you suggested and it worked. Thank you!
Plugin Author
sbouey
(@sbouey)
Thanks to put it as resolved even if it’s 2 months after.
Stéphane