Home Forums WoodMart support forum Header banner translation

Header banner translation

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #604450

    bogdan.raduta
    Participant

    Hi, 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?

    Attachments:
    You must be logged in to view attached files.
    #604477

    bogdan.raduta
    Participant

    In 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
    });
    #604679

    Hung Pham
    Participant

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

Viewing 3 posts - 1 through 3 (of 3 total)