Embed opening hours for any given location from LibCal into WordPress via short codes.
Since this plugin is not available for automatic installation, please follow these Manual Plugin Installation steps.
In the plugin's Admin Settings form, enter the LibCal Hours API Endpoint URL and save the form.
Instructions on how to get that URL can be found on this Wiki page.
Embed the [wplibcalhours]
short code into your posts and pages.
The short code has the following configuration options.
location
... The name of the location that you want to display opening hours for. (mandatory)num_weeks
... The number of weeks of opening hours to display. Accepted values are1
,2
and3
. Defaults to3
. (optional).
[wplibcalhours location="Parnassus Library"]
- This will print the opening hours for the "Parnassus Library" location for the next three weeks (starting today).
[wplibcalhours location="Parnassus Library" num_weeks=1]
- Prints the opening hours for the "Parnassus Library" for the next week (starting today).
This plugin also exposes opening hours via a read-only, public API endpoint.
Requesting the path /wp-admin/admin-ajax.php?action=wplibcalhours
on your site will yield
a JSON-formatted payload comprised of dates and opening hours, keyed by their location names.
These lists are sorted in chronological order and contain day-of-the-week, date and the day's opening hours information.
Each list starts with the current date.
Three locations, the current date is January 3rd.
{
"Parnassus Library": [
{
"day": "Wed",
"date": "Jan 3",
"text": "7:45am - 10pm"
},
{
"day": "Thu",
"date": "Jan 4",
"text": "7:45am - 10pm"
}
/* ... */
],
"Mission Bay Library": [
{
"day": "Wed",
"date": "Jan 3",
"text": "9am - 6pm"
},
{
"day": "Thu",
"date": "Jan 4",
"text": "9am - 6pm"
}
/* ... */
],
"Mission Bay Hub": [
{
"day": "Wed",
"date": "Jan 3",
"text": "24 hours"
},
{
"day": "Thu",
"date": "Jan 4",
"text": "24 hours"
}
/* ... */
]
}
Please see this Wiki page for ideas on how to customize the styles of this plugin's generated markup.
This plugin was created using WordPress Plugin Boilerplate.
Copyright (c) 2017 The Regents of the University of California
This is Open Source Software, published under the MIT license.