> For the complete documentation index, see [llms.txt](https://developers.weglot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.weglot.com/wordpress/use-cases/theme-avada-use-language-selector-in-the-main-menu.md).

# Theme Avada: Use language selector in the main menu

To build its mobile menu, the Avada theme duplicates the main menu with modified attributes, which breaks the Weglot switcher there. Add the JavaScript below (via *Code Snippets* or your theme's `functions.php`) to copy the switcher classes onto the Avada mobile menu.

Avada theme: <https://avada.theme-fusion.com/>

```php
add_action( 'wp_footer', 'weglotsupport_fix_avada_menu' );
function weglotsupport_fix_avada_menu() {
    ?>
    <script type="text/javascript">
        /* WEGLOT FIX AVADA MENU */
        jQuery(document).ready(function ($) {
            var weglotMenuDone = false;
            jQuery(document).on('click', '.fusion-mobile-menu-icons', function () {
                if (weglotMenuDone) {
                    return;
                }
                jQuery(".menu-item-weglot.menu-item-object-custom").each(function () {
                    if (typeof jQuery(this).attr("id") !== 'undefined') {
                        var id = jQuery(this).attr("id");
                        var str = "menu-item-";
                        var dataId = id.substring(str.length, id.length);
                        jQuery('[data-item-id="' + dataId + '"]').addClass(jQuery(this).attr("class"));
                    }
                });
                weglotMenuDone = true;
            });
        });
    </script>
    <?php
}
```
