# Theme Avada: Use language selector in the main menu

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/>

```php
<?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
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.weglot.com/wordpress/use-cases/theme-avada-use-language-selector-in-the-main-menu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
