You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+59Lines changed: 59 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,65 @@ The short code has the following configuration options.
34
34
35
35
`[wplibcalhours location="Parnassus Library" num_weeks=1]` - Prints the opening hours for the "Parnassus Library" for the next week (starting today).
36
36
37
+
## API
38
+
39
+
This plugin also exposes opening hours via a read-only, public API endpoint.
40
+
41
+
Requesting the path `/wp-admin/admin-ajax.php?action=wplibcalhours` on your site will yield
42
+
a JSON-formatted payload comprised of dates and opening hours, keyed by their location names.
43
+
44
+
These lists are sorted in chronological order and contain day-of-the-week, date and the day's opening hours information.
45
+
46
+
Each list starts with the current date.
47
+
48
+
#### Example payload
49
+
50
+
Three locations, the current date is January 3rd.
51
+
52
+
```json
53
+
{
54
+
"Parnassus Library": [
55
+
{
56
+
"day": "Wed",
57
+
"date": "Jan 3",
58
+
"text": "7:45am - 10pm"
59
+
},
60
+
{
61
+
"day": "Thu",
62
+
"date": "Jan 4",
63
+
"text": "7:45am - 10pm"
64
+
}
65
+
//...
66
+
],
67
+
"Mission Bay Library": [
68
+
{
69
+
"day": "Wed",
70
+
"date": "Jan 3",
71
+
"text": "9am - 6pm"
72
+
},
73
+
{
74
+
"day": "Thu",
75
+
"date": "Jan 4",
76
+
"text": "9am - 6pm"
77
+
}
78
+
// ...
79
+
],
80
+
"Mission Bay Hub": [
81
+
{
82
+
"day": "Wed",
83
+
"date": "Jan 3",
84
+
"text": "24 hours"
85
+
},
86
+
{
87
+
"day": "Thu",
88
+
"date": "Jan 4",
89
+
"text": "24 hours"
90
+
}
91
+
// ...
92
+
]
93
+
}
94
+
```
95
+
37
96
## Styling
38
97
39
98
Please see this [Wiki page](https://github.com/ucsf-ckm/wplibcalhours/wiki/Styling-The-Output) for ideas on how to customize the styles of this plugin's generated markup.
0 commit comments