Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #879036

    Hi,
    is it possible to move the main menu wpml languaget switcher next to the search icon?

    #879756

    Hey 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,
    Nikko

    #880171

    I send the ftp credentials
    thank you!

    #880240

    Hi,

    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,
    Nikko

    #880399

    Thank 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.jpg

    and, when I switch to English

    looks like this
    http://www.mkoapostoli.optimedia.gr/jgeorg/menu_2.jpg

    • This reply was modified 6 years, 11 months ago by spapax.
    #880600

    Hi,

    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,
    Nikko

    #880632

    Great Job!
    Thank you very much!

    #880637

    Only one thing is remaining, the language switcher is not visible in the mobile menu, any advice?

    #880711

    Hi,

    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,
    Nikko

    #880731

    I appreciate your help!

    #880813

    Hi,

    You’re always welcome and I’m glad to hear that, just let us know if you need further assistance :)

    Best regards,
    Nikko

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.