// Place the flags at the correct side of the menu according to the the language direction
if (is_rtl())
{
$items = $new_items.$items;
} else {
$items .= $new_items;
}
}
return $items;
}
?>
thanks for your LTR Code, I will implement it tomorrow as a new version.
Conserning your remark about usage .. if you use appearence -> menus then this plugin will be “present”. Was that the case?
This is called wp_nav_menu. I will adapt the description.
Are you sure this theme and you are using the wp_nav_menu (appearence -> menus) ?
as far as I know, yes.
I see in the code of the theme the use of this function.
How can I help you find the problem?
Simon
Ok, I found the problem.
Only when using a custom menu do the flags appear.
I do not know if it is to do with the theme or the way wordpress works.
Please add a clause about this in the plugins description.
and another thing, I fixed the behavior of the flag positioning for rtl languages,
please update the code for other peoples use.
function plugin_wpml_flag_in_menu($items, $args = NULL)
{
if(function_exists('icl_get_languages'))
{
$new_items = '';
$languages = icl_get_languages('skip_missing=0&orderby=code');
if(!empty($languages)){
foreach($languages as $l){
// Exclude current viewing language
if($l['language_code'] != ICL_LANGUAGE_CODE)
{
$new_items .= '';
if(!$l['active']) $new_items .= '';
if($l['country_flag_url']){
$new_items .= '';
}
// $new_items .= icl_disp_language($l['native_name'], $l['translated_name']);
if(!$l['active']) $new_items .= '';
$new_items .= '';
}
}
}
// Place the flags at the correct side of the menu according to the the language direction
if (is_rtl())
{
$items = $new_items.$items;
} else {
$items .= $new_items;
}
}
return $items;
}
?>
Thank you very much!
Simon
the code didn’t copy very well….
you can take it from the WP forum.
Hi Simon,
thanks for your LTR Code, I will implement it tomorrow as a new version.
Conserning your remark about usage .. if you use appearence -> menus then this plugin will be “present”. Was that the case?
This is called wp_nav_menu. I will adapt the description.
Releasing new version (1.1) NOW
🙂