Jump to content

Add multiple buttons to header nav in Squarespace 7.1

Go to solution Solved by tuanphan,

Recommended Posts

  • 3 months later...
12 hours ago, Greenroom said:

Hi Creedon - I have just tried to add the code provided to enable all of my navigation links to be replaced with buttons - Can you please have a look and let me know if I am missing something - I cannot seem to get this to work: www.auconsulting.co.nz

 

Add to Design > Custom CSS

/* nav links to buttons */
.header-nav-item a {
    background-color: #c9a369;
    color: white !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin-bottom: 10px !important;
}

 

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
10 hours ago, tuanphan said:

Add to Design > Custom CSS

/* nav links to buttons */
.header-nav-item a {
    background-color: #c9a369;
    color: white !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin-bottom: 10px !important;
}

 

Thank you!! Also is there a way to split the button/link text so that it is two lines instead of the one? Eg: About Us / Ko wai mātou would become:

About Us
Ko wai mātou (also can this text be a different colour fill)

 

Link to comment
24 minutes ago, WilM said:

I'm now hoping to have my new button launch in a new page/tab. Could I get some guidance on how to do this? Thanks again!

One way is for me to attempt to update my code to account for this behavioral variation.

I'm game to give it a go but it may take several days to accomplish, assuming I can get it done.

Please bump this thread in several days if I've not posted with a response on the status of my code.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
4 hours ago, creedon said:

One way is for me to attempt to update my code to account for this behavioral variation.

I'm game to give it a go but it may take several days to accomplish, assuming I can get it done.

Please bump this thread in several days if I've not posted with a response on the status of my code.

Gah... man - don't sweat it. It's not critical for my site. Was hoping it would be a simple argument to add, but if it's not, please don't go out of your way! 

Link to comment

I have updated my cited code in September 10, 2020 code post.

I have added support for adding a target attribute to the created buttons.

15 hours ago, WilM said:

I'm now hoping to have my new button launch in a new page/tab. Could I get some guidance on how to do this?

Set the value of targetAtttributeValue to _blank

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
On 1/12/2022 at 7:33 AM, creedon said:

I have updated my cited code in September 10, 2020 code post.

I have added support for adding a target attribute to the created buttons.

Set the value of targetAtttributeValue to _blank

Let us know how it goes.

Worked a treat! Thank you so much!!

Link to comment
  • 1 month later...
On 9/10/2020 at 9:43 PM, creedon said:

You will need to have the business plan or above to use this solution.

Please see Add Buttons to Header.

The code allows for adding more than one button as we can see from the following code snippets. Here we add one.

      {
      
        text : 'enter button text here 1',
        url : 'enter url here 1'
        
        },

By repeating the previous data structure we can add more buttons. Here we add two.

      {
      
        text : 'enter button text here 1',
        url : 'enter url here 1'
        
        },
      {
      
        text : 'enter button text here 2',
        url : 'enter url here 2'
        
        },
        

And here we add three.

      {
      
        text : 'enter button text here 1',
        url : 'enter url here 1'
        
        },
      {
      
        text : 'enter button text here 2',
        url : 'enter url here 2'
        
        },
      {
      
        text : 'enter button text here 3',
        url : 'enter url here 3'
        
        },
        

Let us know how it goes.

I've used this code and it works perfectly! Is there a way to center the text within the button, instead of it aligning left @creedon?

Link to comment
41 minutes ago, wlw said:

Is there a way to center the text within the button, instead of it aligning left

Please post the URL for a page on your site where we can see your issue.

If your site is not public please set up a site-wide password, if you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site. Please read the documentation at the link provided to understand how it works.

Please read the documentation at the link provided on how to share a link to your site to understand how it works. A link to the backend of the your site won’t work for us, i.e. a url that contains /config/.

We can then take a look at your issue.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
9 hours ago, creedon said:

Please post the URL for a page on your site where we can see your issue.

If your site is not public please set up a site-wide password, if you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site. Please read the documentation at the link provided to understand how it works.

Please read the documentation at the link provided on how to share a link to your site to understand how it works. A link to the backend of the your site won’t work for us, i.e. a url that contains /config/.

We can then take a look at your issue.

gwcarveracademy.org

Link to comment
On 2/28/2022 at 10:09 AM, wlw said:

I've used this code and it works perfectly! Is there a way to center the text within the button, instead of it aligning left ?

Thank you for reporting this bug.

I have updated the cited code in my September 10, 2020 post.

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
On 9/10/2020 at 9:43 PM, creedon said:

You will need to have the business plan or above to use this solution.

Please see Add Buttons to Header.

The code allows for adding more than one button as we can see from the following code snippets. Here we add one.

      {
      
        text : 'enter button text here 1',
        url : 'enter url here 1'
        
        },

By repeating the previous data structure we can add more buttons. Here we add two.

      {
      
        text : 'enter button text here 1',
        url : 'enter url here 1'
        
        },
      {
      
        text : 'enter button text here 2',
        url : 'enter url here 2'
        
        },
        

And here we add three.

      {
      
        text : 'enter button text here 1',
        url : 'enter url here 1'
        
        },
      {
      
        text : 'enter button text here 2',
        url : 'enter url here 2'
        
        },
      {
      
        text : 'enter button text here 3',
        url : 'enter url here 3'
        
        },
        

Let us know how it goes.

Hello, this has all worked wonderfully, thank you! One question: how do I go about changing the color of the additional button(s)?

Link to comment
2 hours ago, pauljranalli said:

One question: how do I go about changing the color of the additional button(s)?

In general you would use CSS to style the buttons. But without being able to see the buttons we have no clue which button style choices you have made.

Please post the URL for a page on your site where we can see your issue.

If your site is not public please set up a site-wide password, if you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site. Please read the documentation at the link provided to understand how it works.

Please read the documentation at the link provided on how to share a link to your site to understand how it works. A link to the backend of the your site won’t work for us, i.e. a url that contains /config/.

We can then take a look at your issue.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
On 3/3/2022 at 11:06 AM, pauljranalli said:

but am having difficulty locating it.

Add the following to Design > Custom CSS.

.primary-button-style-solid .light .header-actions-action--cta .sqs-button-element--primary:nth-child( 2 ), /* dessktop */
.site-wrapper .header-menu .header-menu-cta a:nth-child( 2 ) /* mobile */

  {
  
    color : red;
    background-color : green;
    border-color : blue;
    
    }

This is for v7.1 and specific to the posters need.

The above would do one button. The following would do more than one.

.primary-button-style-solid .light .header-actions-action--cta .sqs-button-element--primary:nth-child( n+2 ), /* dessktop */
.site-wrapper .header-menu .header-menu-cta a:nth-child( n+2 ) /* mobile */

  {
  
    color : red;
    background-color : green;
    border-color : blue;
    
    }

Let us know how it goes.

Edited by creedon
version 2

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

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.