With this Opening Hours add-on you can define the opening hours of your business in a settings panel. The add-on provides numerous tags to display or check the opening hours. A set of opening hours is created by passing in a regular schedule, and a list of exceptions.
This add-on requires >= PHP7.0
Download or clone the repository, rename the folder to OpeningHours
then copy the folder to your site's Addons
directory, then refresh the add-ons to install the dependencies.
php please addons:refresh
The add-on provides numerous tags, the base tag is {{ opening_hours }}
but always requires a parameter.
Returns days with their opening hours.
<ul>
{{ opening_hours:forWeek }}
<li><strong>Monday</strong></li>
{{ monday }}
<li>{{ from }} - {{ to }}</li>
{{ /monday }}
<li><strong>Tuesday</strong></li>
{{ tuesday }}
<li>{{ from }} - {{ to }}</li>
{{ /tuesday }}
<li><strong>Wednesday</strong></li>
{{ wednesday }}
<li>{{ from }} - {{ to }}</li>
{{ /wednesday }}
...
{{ /opening_hours:forWeek }}
</ul>
Returns the opening hours for a specific day
<ul>
<li><strong>Monday</strong></li>
{{ opening_hours:forDay day="monday" }}
<li>{{ from }} - {{ to }}</li>
{{ /opening_hours:forDay }}
</ul>
Returns the opening hours for a specific date. It looks for exceptions on that day, otherwise it returns the regular opening hours.
<ul>
{{ opening_hours:forDate date="2017-05-25" }}
<li>{{ from }} - {{ to }}</li>
{{ /opening_hours:forDate }}
</ul>
Returns a list of all the exceptions.
<ul>
{{ opening_hours:exceptions }}
<li><strong>{{ date }}</strong></li>
<ul>
{{ hours }}
<li>{{ from }} - {{ to }}</li>
{{ /hours }}
</ul>
{{ /opening_hours:exceptions }}
</ul>
Checks if the business is open on a day in the regular schedule.
{{ opening_hours:isOpenOn day="monday" }}
<p>Yes</p>
{{ /opening_hours:isOpenOn }}
Checks if the business is closed on a day in the regular schedule.
{{ opening_hours:isClosedOn day="sunday" }}
<p>Yes</p>
{{ /opening_hours:isClosedOn }}
Checks if the business is open on a specific day, at a specific time.
{{ opening_hours:isOpenAt date="2017-05-25 09:30" }}
<p>Yes</p>
{{ /opening_hours:isOpenAt }}
Checks if the business is closed on a specific day, at a specific time.
{{ opening_hours:isClosedAt date="2017-05-25 22:30" }}
<p>Yes</p>
{{ /opening_hours:isClosedAt }}
Checks if the business is open right now.
{{ opening_hours:isOpen }}
<p>Open</p>
{{ /opening_hours:isOpen }}
Checks if the business is closed right now.
{{ opening_hours:isClosed }}
<p>Closed</p>
{{ /opening_hours:isClosed }}
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Special thanks to Spatie for making their Opening Hours package
Marbles is a digital communication agency based in Antwerp, Belgium. Learn more about us on our website.
The MIT License (MIT). Please see License File for more information.