Jump to content

[Share] Link an event to an external URL

Recommended Posts

Posted

If code doesn't work, you can send event page url, I will check again.

#A. Specific Events

#1. First, you need to find Event URL

You can hover on each event > Click 3 dots > Settings

image.thumb.png.9df269ec4a1c45824bfc4e3f00af4483.png

and see URL here.

image.png.25e5e6aead8bde4802f5066479f0df5b.png

In my example, we will have:

  • /events-1/event-one
  • /events-1/event-two
  • /events-1/event-six

image.png.35be4cb63d4a5aeeb0578ec02b5eb0e7.png

image.png.94cd17659602fdf230f7d2f8dce77081.png

image.png.5b6f6f3c2102b622c0414b3ae74d6340.png

#2. Use this code to Code Injection > Footer to change these events to external url

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
     $('article:has(a[href="/events-1/event-one"]) a').attr('href','https://squarespace.com');
     $('article:has(a[href="/events-1/event-two"]) a').attr('href','https://instagram.com');
    $('article:has(a[href="/events-1/event-six"]) a').attr('href','https://google.com');
});
</script>

image.png.d446098d9115a9e4e8fec21b639bfff6.png

#B. All Events

Ideas

  • Add external link in Event Excerpt
  • Use code to turn event url to this external link

#1. You can add a hyperlink in Event Excerpt > enter your external link

image.png.e6229bf49fa678f5965d2dfae76d6d31.png

We will have

image.png.fb254a674e2e2d23f7cc3c1f91ed9698.png

#2. Use this code to Code Injection Footer (or Event Page Header Injection)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
  $(document).ready(function(){
    $('article.eventlist-event').each(function() {
        var cr = $(this).find('.eventlist-excerpt a');
        $(this).find('a').attr('href', cr.attr('href'));
    });
  });
</script>

image.png.ab41d3884ab762e0167097de644ca338.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!)

  • Replies 0
  • Views 237
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

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.