-
AuthorPosts
-
November 17, 2025 at 7:58 am #1491394
Hi,
I have a problem and maybe somebody can help.
I use the plugin Gtranslate everything works on desktop view but in mobile view there is no flag in the menu.
Maybe somebody knows the problem and can help me?
Thank you and best regardsNovember 18, 2025 at 6:57 am #1491440Hey walhai,
Thank you for the update.
The theme doesn’t natively support the translation plugin, but you can try this script in the functions.php file to move the translation flags inside the mobile menu.
add_action('wp_footer', function() { ?> <script> jQuery(function($) { function moveGTranslate() { if ($(window).width() <= 768) { var targetLi = $('.menu-item-3651.av-active-burger-items'); if (!targetLi.find('.gtranslate_wrapper').length) { var gtranslate = $('.gtranslate_wrapper'); if (gtranslate.length && targetLi.length) { gtranslate.appendTo(targetLi); } } } } moveGTranslate(); $(window).on('resize', moveGTranslate); }); </script> <?php }, 999);Best regards,
IsmaelNovember 18, 2025 at 9:34 am #1491452Thank you very much for your help.
It partially works. When I open the mobile view the flags are not visible but when I rotate the mobile the flags appear?
I tried to change the window width but it does not work.
Any idea??
Thank you and regardsNovember 19, 2025 at 6:40 am #1491497Hi,
Thank you for the update.
Yes, your solution should work. It moves or creates the translation flags after clicking the mobile menu, ensuring they display correctly when the burger overlay is open.
Best regards,
IsmaelNovember 19, 2025 at 8:24 am #1491503Thank you!
For everybody this worked for me:add_action(‘wp_footer’, function() {
?>
<script>
jQuery(function($){function moveGTranslate() {
if ($(window).width() > 768) return;var targetLi = $(‘.menu-item-3651’); // Ziel-Menu-Punkt
var gtrans = $(‘.gtranslate_wrapper’);// Nur verschieben, wenn beide vorhanden sind
if (targetLi.length && gtrans.length && !targetLi.find(‘.gtranslate_wrapper’).length) {
gtrans.appendTo(targetLi);
}
}// 1) Wiederholen bis GTranslate geladen ist
var waitGT = setInterval(function(){
if ($(‘.gtranslate_wrapper’).length) {
clearInterval(waitGT);
moveGTranslate();
}
}, 300);// 2) Wenn Burger-Menü geöffnet wird
$(document).on(‘click’, ‘.av-hamburger’, function(){
setTimeout(moveGTranslate, 200);
});// 3) Bei Resize (z. B. Rotation)
$(window).on(‘resize’, function(){
setTimeout(moveGTranslate, 150);
});});
</script>
<?php
}, 999);This topic can be closed :))
Best regards
Barbara -
AuthorPosts
- The topic ‘Problem with GTranslate in mobile menue’ is closed to new replies.
