Jump to content

Change the text and link of the header button when switching languages

Go to solution Solved by tuanphan,

Recommended Posts

  • Replies 4
  • Views 370
  • Created
  • Last Reply

Top Posters In This Topic

You want to rename button text or?

If rename button text, follow these

(remember to save a copy of all code somewhere, just for backup)

First, find this code in your language code and change it to

image.png.7693d9ae2ecb84a8396b5b8c5bd3f082.png

to this code

  /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */
  if (lang == "es") {
    $('a[href="/"]').attr("href", "/es/inicio/");
  $("a.btn").html(function() { 
          return $(this).html().replace("Contact us", "ES Contact US");  
    });
  }
 if (lang == "fr") {
   $("a.btn").html(function() { 
          return $(this).html().replace("Contact us", "FR Contact US");  
    });
  }

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Solution

Change the code to this

 /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */
  if (lang == "es") {
    $('a[href="/"]').attr("href", "/es/inicio/");
  $("a.btn").html(function() { 
          return $(this).html().replace("Contact us", "ES Contact US");  
    });
$("a.btn").attr('href','/es/contacta');
  }
 if (lang == "fr") {
   $("a.btn").html(function() { 
          return $(this).html().replace("Contact us", "FR Contact US");  
    });
$("a.btn").attr('href','/fr/contactez-nous');
  }

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.