I want to display translation menu with no flags and no titles. Something like this:
EN | IT
When i click on "EN" the URL goes to english version and when i click on "IT" goes to italian version.
I try everithing, but no solution.
I want to display translation menu with no flags and no titles. Something like this:
EN | IT
When i click on "EN" the URL goes to english version and when i click on "IT" goes to italian version.
I try everithing, but no solution.
You can use qtrans_getLanguage() functions.
if(qtrans_getLanguage() == "en"){
// Enter YOUR ENGLISH LANGUAGE CODE
}elseif(qtrans_getLanguage() == "it"){
// ENTER YOUR ITALIAN LANGUAGE CODE
}
<?php
if ( function_exists( 'register_nav_menus' ) ) {
register_nav_menus(
array(
'menu-header-en' => 'Main Menu EN',
'menu-header-it' => 'Main Menu IT',
)
);
} ?>
// For menu calling
<?php wp_nav_menu( array( 'theme_location' => 'menu-header-' . qtrans_getLanguage() , 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) ); ?>
If you want on mobile screen size or on desktop show the only one flag use this code
<?php
if (qtranxf_getLanguage() == 'ro') {
echo the_widget('qTranslateXWidget', array('type' => 'image', 'hide-title' => true) );
print '<style> .qtranxs_image_ro{display:none;}</style>';
} elseif (qtranxf_getLanguage() == 'ru') {
echo the_widget('qTranslateXWidget', array('type' => 'image', 'hide-title' => true) );
print '<style>.qtranxs_image_ru{display:none;}</style>';
}
?>