Theme OceanWP: Use language selector in the main menu
How to fix the language selector in mobile menu of OceanWP theme
<?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
}PreviousUse custom language code (URL, lang and hreflang attribute)NextTheme Avada: Use language selector in the main menu
Last updated