Jump to content

Change Button Link in Header for one specific page

Go to solution Solved by Beyondspace,

Recommended Posts

  • Solution
15 hours ago, TrademarkTours said:

Site URL: https://www.trademarktours.com/hmc

On our site we use the button in the header to send people to a booking page. For this one specific page on my site, I want that button to take them to a different booking page. Can I accomplish this with a header injection code? (So far I've only succeeded in adding an extra design-less button rather than changing the existing button) 

Try adding to Home > Settings > Advanced > Code injection, footer

<script>
  (function() {
    document.addEventListener('DOMContentLoaded',() => {
      document.querySelector('#collection-619679f0e67cea457538c10c .header-actions--right .header-actions-action--cta a').setAttribute('href','/home');
    })
  })()
</script>

Change the '/home' with the slug/url you want to redirect

Let me know how it works on your site

Press 👍 or mark this answer as solution to help another one too

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

You can use the chrorme exxtension: Squarespace ID Finder

Here is how to find the page id: http://recordit.co/qwnj09oNCa

Hope that it can help you

Edited by bangank36

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
  • 1 month later...

@ekspohz Try this adjusted code

<script>
 (function() {
    document.addEventListener('DOMContentLoaded',() => {
      document.querySelector('#collection-61d9dcf755b23e793054204b .Header-nav--secondary a').setAttribute('href','/home');
    })
  })()
</script>

 

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

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.