Jump to content

Different CTA button for one page only

Go to solution Solved by tuanphan,

Recommended Posts

Posted

Hello there! 

I'd like to replace the call to action button that's currently showing on my website (drmiguelmateas.com) with a different CTA button on one page only. I have a course page with details of a course I'm offering and the CTA links to that page. However, on the course page itself (https://drmiguelmateas.com/thrive-with-adhd-course) I'd like the CTA button to link to the course login page on my Squarespace member pages. 

Can someone help with this? I've looked at various posts around similar situations but the code used in those has not worked. 

Thank you so much in advance! 

Miguel 

  • Replies 6
  • Views 1.4k
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Hi @tuanphan! Happy New Year to you! 

I did remove the button as a temporary solution.

I'd like to change the button URL and rename the button text. Literally, I'd like for the button to say "Course Login" on that specific page only. 

Thank you so much for your help! 

Miguel

  • Solution
Posted

Add this code to Page Header Code Injection to change text + url

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("a.btn").html(function() { 
          return $(this).html().replace("MY THRIVE WITH ADHD COURSE", "new text");  
    });
  $("a.btn").attr('href','https://google.com');
});
</script>

Replace new text to text what you want and google with new url

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!)

Posted

Are you able to add a Code Block to page? if yes, you can add code to Code Block. If it doesn't support Code Block, add this code to Website Tools (under Not Linked) > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $('#sqs-paywall-page-root').closest('body').addClass('paywall-body');
    $("body.paywall-body a.btn").html(function() { 
          return $(this).html().replace("MY THRIVE WITH ADHD COURSE", "new text");  
    });
  $("body.paywall-body a.btn").attr('href','https://google.com');
});
</script>

 

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!)

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.