-
Hi,
I am trying to customize main dropdown navigation with WPML languages to
a) if possible, link to external website if there is missing translation
b) if not possible, NOT show language translation at all if missing translation.DESKTOP
I have found that you use this function ‘icl_get_languages’ in the /includes/header-top-bar.php.
In the WPML documentation (https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/) they show that you need to add additional element – ‘skip_missing’ parameter which tells the function how to treat languages with no translations.
I have changed code to:
$languages = icl_get_languages(‘skip_missing=1’)
however I don’t see any changes.There is something wrong with your function if you cannot modify it based on official documentation? What is changed?
MOBILE
On the mobile site, however there is some different function (menu language switcher) so I have been able to change based on my needs. For everyone looking for this, here is code:
/* CHANGE LINK OF WPML LANG TO EXTERNAL LINK */
add_filter(‘wpml_ls_language_url’, ‘redirect_link’,10,2);
function redirect_link($url,$lang){
if( $lang[‘code’] == “hr” ) {
$permalink_to_external = ‘link.com’;
$lang[‘url’] = apply_filters( ‘wpml_permalink’, $permalink_to_external , $lang[‘language_code’] );
}
return $lang[‘url’];
}Question here is if I can modify this function.php code to work for desktop main navigation in dropdown as well?
Hopefully it’s clear what is the issue, if not, please ask anything that can help you help me 🙂 Thanks in advance!
Best,
Marin
-
HB-Themes support team typically replies to all topics within 48 hours except on weekends and public holidays. You must register to post topics.
Forum Categories
- Highend WP Theme 25,512
- Aegaeus WP Theme 1,617
- Requests and Feedback 133