Jump to content

Changing wording of the "Back to All Events" link on an event view and the URL it goes to.

Recommended Posts

  • Replies 4
  • Views 895
  • Created
  • Last Reply

You can add the following Javascript via Code Injection. Just edit the values of the UPDATED_TEXT and UPDATED_URL variables in the code to what you want. I went ahead and used the values you provided.

JavaScript

(function($){

  var UPDATED_TEXT = 'Back To Calendar';
  var UPDATED_URL = '/monthly-calendar';

  /*********************************************************
   * DO NOT EDIT BELOW THIS LINE
   **********************************************************/
  if(!$) {
    var s = document.createElement('script');
    s.src = 'https://code.jquery.com/jquery-3.6.0.min.js';
    s.integrity = 'sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=';
    s.crossorigin = 'anonymous';
    s.onload = init;
    document.body.appendChild(s);
  } else {
    $(document).ready(init);
  }

  function init(){
    var $backLink = $('.eventitem-backlink');
    var url = UPDATED_URL || $backLink.attr('href');
    var text = UPDATED_TEXT || $backLink.html();
    $backLink
      .html(text)
      .attr('href', url);

  }
})(jQuery);

 

Make sure the code above is in between <script></script> tags. e.g.:

<script>
  // JS code goes here
</script>

 

Full stack developer who loves helping people out with anything web related. If you'd like to support me, buy me a coffee!

Link to comment
16 hours ago, jpeter said:

You can add the following Javascript via Code Injection. Just edit the values of the UPDATED_TEXT and UPDATED_URL variables in the code to what you want. I went ahead and used the values you provided.

JavaScript


(function($){

  var UPDATED_TEXT = 'Back To Calendar';
  var UPDATED_URL = '/monthly-calendar';

  /*********************************************************
   * DO NOT EDIT BELOW THIS LINE
   **********************************************************/
  if(!$) {
    var s = document.createElement('script');
    s.src = 'https://code.jquery.com/jquery-3.6.0.min.js';
    s.integrity = 'sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=';
    s.crossorigin = 'anonymous';
    s.onload = init;
  } else {
    $(document).ready(init);
  }

  function init(){
    var $backLink = $('.eventitem-backlink');
    var url = UPDATED_URL || $backLink.attr('href');
    var text = UPDATED_TEXT || $backLink.html();
    $backLink
      .html(text)
      .attr('href', url);

  }
})(jQuery);

 

Make sure the code above is in between <script></script> tags. e.g.:


<script>
  // JS code goes here
</script>

 

jpeter, This code was awesome and worked like a charm! Thank you so much!

Link to comment

@MarLo56 I see some blocks on tablet doesnt look good.

You can add this to Design > Custom CSS > Then save & reload your site

/* Fix tablet posters */
@media screen and (max-width:991px) and (min-width:768px) {
div#page-section-604c098eb1aad7403ed12db2 .image-inset {
    padding-bottom: 200% !important;
}
}

image.thumb.png.3e8bd67e2e6d060565083af0fbee3169.png

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

Archived

This topic is now archived and is closed to further replies.


×
×
  • 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.