Jump to content

rabidzoomonkey

Member
  • Posts

    7
  • Joined

  • Last visited

Reputation Activity

  1. Like
    rabidzoomonkey got a reaction from TerranRogue in Upgrading from Avenue to 7.1   
    After switching templates all of your pages and content should be in the not linked section. The demo content is only added so you can see the various features and styles of the new template.
    https://support.squarespace.com/hc/en-us/articles/205815598-Switching-templates-in-version-7-0#toc-step-3---preview-the-template
    (That first link was messed up I think, oops! This one should load)
  2. Thanks
    rabidzoomonkey reacted to paul2009 in Add Business hours in multiple locations   
    Sure, here's some code to get you started. It will require a Business billing plan or above because it contains some HTML and JavaScript.
    Add the code below to a Code Block, positioned wherever you want the day's opening hours to appear. You can amend the times and the messaging to suit your needs. Ensure that the Code Block is set to HTML. 
    <div class="sf-opening-hours"></div> <script> // Store opening hours (replace with actual shopping hours) const storeHours = {   Monday: { open: "9:00 AM", close: "5:00 PM" },   Tuesday: { open: "9:00 AM", close: "5:00 PM" },   Wednesday: { open: "9:00 AM", close: "5:00 PM" },   Thursday: { open: "9:00 AM", close: "7:00 PM" },   Friday: { open: "9:00 AM", close: "5:00 PM" },   Saturday: { open: "10:00 AM", close: "4:00 PM" },   Sunday: { open: "Closed", close: "Closed" }, }; // Get the current day and time according to the locale specified const today = new Date(); const currentDay = today.toLocaleDateString("en-US", { weekday: "long" }); const currentTime = today.toLocaleTimeString("en-US"); // Find the opening hours div on the page const openingHours = document.querySelector(".sf-opening-hours"); // Check if the store is open if (storeHours[currentDay].open !== "Closed" && storeHours[currentDay].close !== "Closed") {   const openTime = storeHours[currentDay].open;   const closeTime = storeHours[currentDay].close;     openingHours.textContent = `Today's opening hours: ${openTime} - ${closeTime}`; } else {   openingHours.textContent = "Sorry, the store is closed today."; } </script> In this simplified example, we first create a div element to hold the text that will show the opening hours. The opening hours are then defined for each day of the week. Next, we grab the current day and time, according to the locale specified. We check if the shopping centre is currently open by comparing the open and close properties of the storeHours object for the current day. It doesn't take into account users who may be located in a different timezone.
    If the shopping centre is open, the div element is populated with today's opening hours. If it is closed, we display a message indicating that the shopping centre is currently closed.
    If you want to style the message, you can add some CSS to Design > Custom CSS. For example, to set the text to 24px:
    .sf-opening-hours {   font-size: 24px; } Did this help? Please give feedback by clicking an icon below  ⬇️
×
×
  • 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.