GraceLS Posted September 2, 2020 Share Posted September 2, 2020 Site URL: https://www.craft.org.au/craftcontemporaryprogramming Hi Squarespace community! I am hoping someone can please assist with some code to inject into an event list (not site wide, just an event list) that allows you to customise the URL and display text (<-- Back to All Events) thanks so much! Link to comment
tuanphan Posted September 2, 2020 Share Posted September 2, 2020 Can you share link to event in screenshot? We can check easier. 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
GraceLS Posted September 2, 2020 Author Share Posted September 2, 2020 Hi tuanphan, sure! Here is a link https://www.craft.org.au/craft-contemporary-events/from-idea-to-reality I would like to customise 'Back To All Events' text and URL that is displayed in the top left hand corner below the logo if that is possible. Thanks so much! 🙂 Link to comment
tuanphan Posted September 2, 2020 Share Posted September 2, 2020 Add to Home > Settings > Advanced > Code Injection > Footer <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> jQuery(function($){ $(".eventitem-backlink").html(function() { return $(this).html().replace("Back to All Events", "New text"); }); }); </script> clairebrear 1 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
GraceLS Posted September 2, 2020 Author Share Posted September 2, 2020 Hi Tuan that is fantastic thank you! The code worked and updated the 'Back to All Events' text, thanks so much for your help! I am hoping to now replace the link for that text and link that text to a different url (this URL (which is the overview of all events) https://www.craft.org.au/craftcontemporaryprogramming) i.e replace the link for the 'Back to Craft Contemporary Hub' text Link to comment
tuanphan Posted September 2, 2020 Share Posted September 2, 2020 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> jQuery(function($){ $(".eventitem-backlink").html(function() { return $(this).html().replace("Back to All Events", "New text"); }); $('.eventitem-backlink').attr('href','https://beaverhero.com'); }); </script> replace beaverhero with new url GraceLS 1 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
GraceLS Posted September 3, 2020 Author Share Posted September 3, 2020 Thank you Tuan you have saved the day! 🙂 Link to comment
nathanchien Posted February 26, 2021 Share Posted February 26, 2021 @tuanphan Thanks for this! Unfortunately this is not working with Ajax enabled for me. Any ideas why that would be? Working on a 7.0 Brine site. Thanks! Link to comment
creedon Posted February 26, 2021 Share Posted February 26, 2021 @nathanchien Please post the URL for your event page on your site. 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 is not a security breach. Please read the documentation at the link provided to understand how it works. 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
captbackfire Posted June 21, 2023 Share Posted June 21, 2023 Is it possible to use this same function to add a second link and text in line with the first? Link to comment
tuanphan Posted June 23, 2023 Share Posted June 23, 2023 On 6/21/2023 at 9:14 PM, captbackfire said: Is it possible to use this same function to add a second link and text in line with the first? Add it here? 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
captbackfire Posted June 23, 2023 Share Posted June 23, 2023 (edited) Let me give you the background of what I need to do. A better answer has to exist. The site I'm deploying has two calendars: Preschool Events and K-8th Events. Instead of sending the user back to All Events, I want to send them back to the calendar page from whence they just came. I've read the two other articles on changing the URL of the Back to All Events link, and in both, the new target was a fixed URL. I would like to have the script automatically determine by some criteria (document referrer, category, tag, etc) which of the two calendar pages the user came from based on where they are and make that URL the target of the back button. Diagnostic Testing (Reading and Math) — The SAE School (squarespace.com) K-8 Events — The SAE School (squarespace.com) Preschool Events — The SAE School (squarespace.com) My thinking on adding a second link where your red box is was to just create two manual static links and avoid all logic. Edited June 23, 2023 by captbackfire Link to comment
tuanphan Posted June 25, 2023 Share Posted June 25, 2023 On 6/23/2023 at 9:48 PM, captbackfire said: Let me give you the background of what I need to do. A better answer has to exist. The site I'm deploying has two calendars: Preschool Events and K-8th Events. Instead of sending the user back to All Events, I want to send them back to the calendar page from whence they just came. I've read the two other articles on changing the URL of the Back to All Events link, and in both, the new target was a fixed URL. I would like to have the script automatically determine by some criteria (document referrer, category, tag, etc) which of the two calendar pages the user came from based on where they are and make that URL the target of the back button. Diagnostic Testing (Reading and Math) — The SAE School (squarespace.com) K-8 Events — The SAE School (squarespace.com) Preschool Events — The SAE School (squarespace.com) My thinking on adding a second link where your red box is was to just create two manual static links and avoid all logic. What is access password? 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
tuanphan Posted June 26, 2023 Share Posted June 26, 2023 https://cinnamon-bellflower-84lt.squarespace.com/preschoolevents/preschool-meet-greet-dragon-drop-in https://cinnamon-bellflower-84lt.squarespace.com/k8-events You can add code to Page Header: Preschool Meet Event Page Header <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> jQuery(function($){ $(".eventitem-backlink").html(function() { return $(this).html().replace("Back to All Events", "Back to Preschool Events"); }); $('.eventitem-backlink').attr('href','/preschoolevents'); }); </script> and add this to K-8 Events Page Header <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> jQuery(function($){ $(".eventitem-backlink").html(function() { return $(this).html().replace("Back to All Events", "Back to K8 Events"); }); $('.eventitem-backlink').attr('href','/k8-events'); }); </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!) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment