Home / Forums / WoodMart support forum / Header banner translation
Home › Forums › WoodMart support forum › Header banner translation
Header banner translation
- This topic has 2 replies, 2 voices, and was last updated 2 years ago by
Hung Pham.
-
AuthorPosts
-
October 11, 2024 at 3:34 pm #604450
bogdan.radutaParticipantHi, how can I translate the string from the header banner? I am using WPML but I cannot find the text that I wrote.
Also, is there a way to hide it for a certain language?-
This topic was modified 2 years ago by
bogdan.raduta.
Attachments:
You must be logged in to view attached files.October 11, 2024 at 4:52 pm #604477
bogdan.radutaParticipantIn case there are others needing this setting, I have created a script that hides the banner. The site of my client is translated in Romanian and English and they want the header banner to be hidden if the language is set to English.
document.addEventListener("DOMContentLoaded", function() { // Function to remove the 'header-banner-display' class from the body, only for en-US function removeHeaderBannerForEnglish() { var body = document.body; var htmlLang = document.documentElement.lang; // Get the language from the <html> tag // If the language is English (en-US) and the banner is visible, remove the class if (htmlLang === 'en-US' && body.classList.contains('header-banner-display')) { body.classList.remove('header-banner-display'); } } // Observe changes to the body element to detect when 'header-banner-display' is added var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.type === 'attributes' || mutation.type === 'childList') { removeHeaderBannerForEnglish(); // Remove the class on every DOM change for en-US } }); }); // Start observing the body for DOM changes observer.observe(document.body, { attributes: true, childList: true, subtree: true }); // Initial check in case the class is already applied setTimeout(removeHeaderBannerForEnglish, 2000); // Delay of 2 seconds to ensure theme's JS completes });October 13, 2024 at 5:09 pm #604679
Hung PhamParticipantHi bogdan.raduta,
Thanks for reaching to us and appreciate your patience.
To assist you in the best possible manner, I kindly ask that you please provide me temporary wp-admin info (wp-admin URL, username, password) to the Private Content area, this will allow me to thoroughly investigate and address your concerns more efficiently.
Regards,
-
This topic was modified 2 years ago by
-
AuthorPosts
- You must be logged in to create new topics. Login / Register