-
AuthorPosts
-
November 20, 2017 at 11:07 am #879036
Hi,
is it possible to move the main menu wpml languaget switcher next to the search icon?
November 21, 2017 at 3:19 pm #879756Hey spapax,
It’s possible but a bit complicated, can we ask for your ftp access? we’ll try to move it via js script, then just post the steps on how we moved it.
Best regards,
NikkoNovember 22, 2017 at 11:18 am #880171I send the ftp credentials
thank you!November 22, 2017 at 1:41 pm #880240Hi,
Thanks for providing the ftp credentials, I have added this code at the bottom of functions.php
function avia_custom_script(){ ?> <script> (function($){ function moveFlag() { var flag = $('#header').find('#menu-item-wpml-ls-26-en'); $(flag).prependTo('#header .social_bookmarks'); } moveFlag(); })(jQuery); </script> <?php } add_action('wp_footer', 'avia_custom_script');
and added this css code in style.css (in your child theme):
#header_main nav .social_bookmarks { overflow: visible !important; } #header #menu-item-wpml-ls-26-en, #header #menu-item-wpml-ls-26-en > a { width: auto; } #header #menu-item-wpml-ls-26-en ul { display: block; opacity: 0; visibility: hidden; margin-left:0; left:0; position: absolute; top: 100%; width: 208px; z-index: 2; padding:0; box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1); margin-top:-1px; -webkit-transition: all 0.4s ease-in-out; transition: all 0.4s ease-in-out; } #header #menu-item-wpml-ls-26-en:hover ul { opacity: 1; visibility: visible; } #header #menu-item-wpml-ls-26-en ul li { margin:0; padding:0; width:100%; } #header #menu-item-wpml-ls-26-en ul li a { border-right-style: solid; border-right-width:1px; border-left-style: solid; border-left-width:1px; border-radius: 0 !important; } #header #menu-item-wpml-ls-26-en ul li:last-child > a { border-bottom-style: solid; border-bottom-width: 1px; } #header #menu-item-wpml-ls-26-en ul li a { width: 100% !important; }
Hope it’s good :)
Best regards,
NikkoNovember 22, 2017 at 6:36 pm #880399Thank you Nikko, but is a bit messed up
When the current language is Greek
It looks like this
http://www.mkoapostoli.optimedia.gr/jgeorg/menu_1.jpgand, when I switch to English
looks like this
http://www.mkoapostoli.optimedia.gr/jgeorg/menu_2.jpg- This reply was modified 7 years ago by spapax.
November 23, 2017 at 6:46 am #880600Hi,
Sorry I missed that. I have tweaked the code I gave.
Functions.php:function avia_custom_script(){ ?> <script> (function($){ function moveFlag() { var flag = $('#header').find('.menu-item-language-current'); $(flag).prependTo('#header .social_bookmarks'); } moveFlag(); })(jQuery); </script> <?php } add_action('wp_footer', 'avia_custom_script');
style.css:
#header_main nav .social_bookmarks { overflow: visible !important; } #top #header #header_main .menu-item-language-current, #top #header #header_main .menu-item-language-current > a { width: auto; } #header #header_main .menu-item-language-current > a { padding-right: 10px; } #top #header #header_main .menu-item-language-current ul { display: block; opacity: 0; visibility: hidden; margin-left:0; left:0; position: absolute; top: 100%; width: 208px; z-index: 2; padding:0; box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1); margin-top:-1px; -webkit-transition: all 0.4s ease-in-out; transition: all 0.4s ease-in-out; } #top #header #header_main .menu-item-language-current:hover ul { opacity: 1; visibility: visible; } #top #header #header_main .menu-item-language-current ul li { margin:0; padding:0; width:100%; } #top #header #header_main .menu-item-language-current ul li a { border-right-style: solid; border-right-width:1px; border-left-style: solid; border-left-width:1px; border-radius: 0 !important; } #top #header #header_main .menu-item-language-current ul li:last-child > a { border-bottom-style: solid; border-bottom-width: 1px; } #top #header #header_main .menu-item-language-current ul li a { width: 100% !important; }
Clearing browser cache might be needed to view properly. Let us know if there are any issues :)
Best regards,
NikkoNovember 23, 2017 at 9:41 am #880632Great Job!
Thank you very much!November 23, 2017 at 10:07 am #880637Only one thing is remaining, the language switcher is not visible in the mobile menu, any advice?
November 23, 2017 at 2:53 pm #880711Hi,
You’re welcome, I have adjusted the code I made in functions.php:
function avia_custom_script(){ if( !wp_is_mobile() ): ?> <script> (function($){ function moveFlag() { var flag = $('#header').find('.menu-item-language-current'); $(flag).prependTo('#header .social_bookmarks'); } moveFlag(); })(jQuery); </script> <?php endif; } add_action('wp_footer', 'avia_custom_script');
The language should be seen along with other menu items (after clicking the burger menu) on mobile. :)
Best regards,
NikkoNovember 23, 2017 at 3:23 pm #880731I appreciate your help!
November 23, 2017 at 5:49 pm #880813Hi,
You’re always welcome and I’m glad to hear that, just let us know if you need further assistance :)
Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.