Button on header to two links depending on laguange

Hi!

How do I make the button on the top header go to one page on my local language site (https://levendestreg.dk/om-os/#services) and then to the translated version (https://levendestreg.dk/en/about/#services) on my English version of the site?

My site is levendestreg.dk.

Best regards, Maria

Hello Maria,

Try doing the below steps:

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided box
    ;(function($) {
      
      // Function to alter button text and link address
      $.fn.slideButtonAttribute = function(myText, myUrl) {
        if( this.length ) {
          this.text(myText).attr('href', myUrl);
        }
      }

      // da-DK
      $('html[lang="da-DK"] .header-slider .button-slider').slideButtonAttribute('My Button Text', 'https://levendestreg.dk/om-os/#services');

      // en-UD
      $('html[lang="en-US"] .header-slider .button-slider').slideButtonAttribute('My Button Text', 'https://levendestreg.dk/en/#services');

    })(jQuery);

Replace each button label and link target defined in this method above:

    .slideButtonAttribute('My Button Text', 'https://levendestreg.dk/om-os/#services')
  1. Update

Regards,
Kharis

Thank you for great service!

You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis