> 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-oceanwp-use-language-selector-in-the-main-menu.md).

# Theme OceanWP: Use language selector in the main menu

To build its mobile menu, the OceanWP 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 fix the switcher classes in the OceanWP mobile menu.

OceanWP theme: <https://oceanwp.org/>

```php
add_action( 'wp_footer', 'weglotsupport_wpocean_menu' );
function weglotsupport_wpocean_menu() {
    ?>
    <script type="text/javascript">
        /* WEGLOT FIX WP OCEAN MENU */
        jQuery(document).ready(function ($) {
            var weglotMenuDone = false;
            jQuery(document).on('click', '.oceanwp-theme .mobile-menu', function () {
                if (weglotMenuDone) {
                    return;
                }
                jQuery(".sidr-class-weglot-flags").each(function () {
                    if (typeof jQuery(this).attr("class") !== 'undefined') {
                        var element_class = jQuery(this).attr("class");
                        jQuery(this).addClass(element_class.replace(/sidr-class-/g, ''));
                    }
                });
                weglotMenuDone = true;
            });
        });
    </script>
    <?php
}
```
