ChristinaB Posted June 20 Posted June 20 Hello! I'm looking for a solution to add a widget code to a header button. website: https://millandmainrestaurant.squarespace.com/reservations Does anyone know how to do that? Thank you! the code I have: <div style="text-align: center;"><a href="https://resy.com/cities/kerhonkson-ny/venues/mill-and-main" id="resyButton-ZMLifg9xYpLYfaOawWuqJ">Book your Mill & Main reservation on Resy</a></div> <script src="https://widgets.resy.com/embed.js"></script> <script> resyWidget.addButton(document.getElementById('resyButton-ZMLifg9xYpLYfaOawWuqJ'), {"venueId":72291,"apiKey":"sAqIjRUrrfAL9EzFQNEQjH6gTP64obBX","replace":true}); </script>
Lesum Posted June 20 Posted June 20 @ChristinaB Hi! I haven't been able to test the code on your site since it requires a custom script to set the ID to the header button. Please try adding this code under Website > Settings > Advanced > Code Injection > Header. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function() { var link = $('.header-actions-action .btn'); link.attr('href', 'https://resy.com/cities/kerhonkson-ny/venues/mill-and-main" id="resyButton-ZMLifg9xYpLYfaOawWuqJ'); link.attr('id', 'resyButton-ZMLifg9xYpLYfaOawWuqJ'); }); </script> <script src="https://widgets.resy.com/embed.js"></script> <script> resyWidget.addButton(document.getElementById('resyButton-ZMLifg9xYpLYfaOawWuqJ'), {"venueId":72291,"apiKey":"sAqIjRUrrfAL9EzFQNEQjH6gTP64obBX","replace":true}); </script> Let me know how it goes. Thanks! If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. Sam Web Developer & Digital Designer ☕ Did you find my contribution helpful? Buy me a coffee?
ChristinaB Posted June 20 Author Posted June 20 @Lesum It didn't work 😞 I want it to show up as a popup like on this page, I embedded the code I mentioned earlier https://millandmainrestaurant.squarespace.com/reservations
Lesum Posted June 20 Posted June 20 @ChristinaB I only added the URL and ID to the button based on the information you shared in your script. How it is supposed to pop up on the page depends on the third-party platform where you got the embed code from. Please check if everything is set up correctly there, and if there is an issue, try contacting their support. If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. Sam Web Developer & Digital Designer ☕ Did you find my contribution helpful? Buy me a coffee?
ChristinaB Posted June 20 Author Posted June 20 @Lesum Did you check the link I sent you? https://millandmainrestaurant.squarespace.com/reservations password: 0000 is there a way to add the same functionality to the header button as the red button one?
Lesum Posted June 20 Posted June 20 @ChristinaB Yes I checked your link and wrote the code solution based on your website header. However, code I shared isn't working as the red button is opening the popup inside an iframe. You can try adding a link under you main navigation. Then add the embed code inside the link URL. If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. Sam Web Developer & Digital Designer ☕ Did you find my contribution helpful? Buy me a coffee?
tuanphan Posted June 22 Posted June 22 Can you send 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!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment