grpace
1/6/2017 - 12:01 AM

Hide Code During Certain Hours

Hide Code During Certain Hours

// This example is code to hide code during certain hours all pages after 6pm until 8am
// Also option to display 24 hours on certain pages.
// This example it will display 24 hours on anything including "/secure-zone/"

{% assign getHour = globals.site.dateNow | date: "HH" -%}
{% assign securePath = globals.get.id | split: '/' -%}
{% if getHour <= '18' and getHour >= '8' and securePath[0] != 'secure-zone' -%}
Insert Code
{% elsif securePath[0] == 'secure-zone' -%}
Insert Code
{% else -%}
{% endif -%}