Theme Avada: Use language selector in the main menu
How to fix the language selector in mobile menu of Avada theme
To create the mobile menu, the Avada theme duplicate the main menu with modified attribute. To fix Weglot language selector on this mobile menu, you must add the following code into your functions.php file. It's add JavaScript code into your page to fix this modified attribute.
Theme Avada website : https://avada.theme-fusion.com/
1
<?php
2
3
add_action( 'wp_footer', 'weglotsupport_fix_avada_menu' );
4
function weglotsupport_fix_avada_menu() {
5
?>
6
<script type="text/javascript">
7
/* WEGLOT FIX AVADA MENU */
8
jQuery(document).ready(function ($) {
9
var weglotMenuDone = false;
10
jQuery(document).on('click', '.fusion-mobile-menu-icons', function() {
11
if (weglotMenuDone) {
12
return;
13
}
14
jQuery(".menu-item-weglot.menu-item-object-custom").each(function() {
15
if ( typeof jQuery(this).attr("id") !== 'undefined' ) {
16
var id = jQuery(this).attr("id");
17
var str = "menu-item-";
18
var dataId = id.substring(str.length, id.length);
19
jQuery('[data-item-id=\"' + dataId + '\"]').addClass( jQuery(this).attr("class") );
20
}
21
});
22
weglotMenuDone = true;
23
} );
24
});
25
</script>
26
<?php
27
}
Copied!
Last modified 1yr ago
Copy link