Mary_DG Posted November 8, 2023 Share Posted November 8, 2023 Hello everyone, I added a code (thank you Brad) to display EN only and ES only depending on the language selected. I however have a code to display the header with the logo in the middle and split the menu items on the side. www.hellocinnamon.com I created duplicate for each page in ES language . Can anybody help with the having the logo in ES to display in ES pages only. Below is the code I use for the split navigation: /* =================================== SPLIT NAVIGATION STYLING =================================== */ @splitAfterItem: 4; @actionSize: 1px; @logoSpacing: 1vw; //Width at which nav will stack @media screen and (min-width:1200px) { //Dynamic Nav font size #header .header-nav-item { font-size: clamp(8px,calc(~".6vw + 5px"),18px); } //Split Structure #header .header-layout-branding-center-nav-center .header-display-desktop .header-title-nav-wrapper { display: grid; grid-template-columns:1fr auto 1fr; .header-nav,.header-title { grid-row-start: 1; } .header-nav { margin-top: 0; } .header-nav-item a { opacity: 0; transform: none!important; transition: opacity .3s linear; } &.has-nav .header-nav-item a{opacity:1!important;} .header-title{grid-column-start:2;} @splitOne: @splitAfterItem + 1; .header-nav:first-child .header-nav-list > div:nth-child(n +@{splitOne}) {display: none;} .header-nav:not(:first-child) .header-nav-list > div:nth-child(-n +@{splitAfterItem}){display:none;} //Left side nav .header-nav:first-child { display: block; text-align: right; margin-right: @logoSpacing; .header-nav-list { justify-content: flex-end; } } //Right side nav .header-nav:not(:first-child) { text-align: left; margin-left: @logoSpacing; .header-nav-list{justify-content:flex-start;} }}} //Give nav more width #header .header-layout-branding-center-nav-center .header-display-desktop { .header-title-nav-wrapper { flex: 0 0 calc(~"100% - @{actionSize} * 2"); } .header-actions{ width:@actionSize; flex: 0 1 @actionSize; max-width: @actionSize; } //hide left side nav when stacked .header-nav:first-child { display: none; } } .header-title-logo a { max-height: unset !important; } /* =================================== end SPLIT NAVIGATION STYLING =================================== */ and this is the code I have for the English/Espanol language switch. <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.6.0/css/flag-icon.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(function() { /* SETUP MULTI-LANGUAGE */ var defaultLanguage = 'en'; var lang = location.pathname.split("/")[1]; var defaultClass = 'lang-'+defaultLanguage+''; var itemParent = "nav [class*='collection'],nav [class*='folder'],nav [class*='index'],nav [class*='group']"; if (lang == "" || lang.length > 2 ){ var lang = defaultLanguage; } /* ADD LANGUAGE CLASSES */ $('a[href="/"]').addClass('lang-'+defaultLanguage+'').parents(itemParent).addClass('lang-'+defaultLanguage+''); $('nav a:link:not([href^="http://"]):not([href^="https://"])').each(function () { var langType = $(this).attr('href').split("/")[1]; var multiLanguageClass = 'multilanguage lang-' + langType + ''; if (undefined !== langType && langType.length <= 2) $(this).addClass(multiLanguageClass).parents(itemParent).addClass(multiLanguageClass); }); $('nav button').each(function () { var langTypeFolder = $(this).attr('data-controller-folder-toggle').split("/")[0]; var multiLanguageClass = 'multilanguage lang-' + langTypeFolder + ''; if (undefined !== langTypeFolder && langTypeFolder.length <= 2) $(this).addClass(multiLanguageClass); }); /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */ if (lang == "es") { $('a[href="/"]').attr("href", "/es/inicio/"); } /* ADD EXCLUSION NAV ITEMS */ $('.exclude-me,.exclude-me a').addClass('exclude'); $('.sqs-svg-icon--list a,.SocialLinks-link,.header-menu-controls-control').addClass('exclude'); /* REMOVE OTHER LANGUAGES AND KEEP EXCLUDED ITEMS */ $('.multilanguage:not(".lang-'+lang+',.exclude")').remove(); /* SETUP LANGUAGE SWITCHER */ $('body').prepend('<div class="language"><a href="/en/home" class="lang-en"><span class="flag-icon flag-icon-us"></span></a> <a href="/es/inicio/" class="lang-es"><span class="flag-icon flag-icon-mx"></span></a></div>'); }); </script> Appreciate everybody who can help. Thank you in advance. Link to comment
Solution Mary_DG Posted December 5, 2023 Author Solution Share Posted December 5, 2023 Hi, this was resolved by adding on CSS /**Spanish logo**/ body.body-es header#header img { content: url(spanishlogo.jpg); } Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment