• Resolved williamhartm

    (@williamhartm)


    Hi!

    I’d like to translate a website with your plugin. The dropdown menu doesn’t show up when I hover the button in the header of the page, probably ’cause I use a custom theme. It shows the current language, I’d like to change that to the other language (english).
    I used this code to change the country flag and the link:

    if (WPGlobus.language == 'nl') {
      jQuery('.wpglobus-current-language a span').removeClass('wpglobus_flag_nl').addClass('wpglobus_flag_en');
      jQuery('.wpglobus-current-language a').attr('href', location.origin + '/en');
    } else {
      jQuery('.wpglobus-current-language a span').removeClass('wpglobus_flag_en').addClass('wpglobus_flag_nl');
      jQuery('.wpglobus-current-language a').attr('href', location.origin);
    }

    Now it shows the flag of the language you’ll get when you click on it, the url change as well to right language.
    How can I change the language letters to the other language when you’ll click on it, by custom js?
    Check https://epifyse.nl/

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Alex Gor

    (@alexgff)

    Switcher works correctly.
    I don’t understand what you want to do more.

    Thread Starter williamhartm

    (@williamhartm)

    After I posted I’ve added two lines to the code, now it works fine!

    if (WPGlobus.language == 'nl') {
      jQuery('.wpglobus-current-language a span').html("EN");
      jQuery('.wpglobus-current-language a span').removeClass('wpglobus_flag_nl').addClass('wpglobus_flag_en');
      jQuery('.wpglobus-current-language a').attr('href', location.origin + '/en');
    } else {
      jQuery('.wpglobus-current-language a span').html("NL");
      jQuery('.wpglobus-current-language a span').removeClass('wpglobus_flag_en').addClass('wpglobus_flag_nl');
      jQuery('.wpglobus-current-language a').attr('href', location.origin);
    }
    Thread Starter williamhartm

    (@williamhartm)

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Language button shows wrong language’ is closed to new replies.