Skip to content

Commit

Permalink
added API section to readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
stopfstedt committed Jan 3, 2018
1 parent a428fbd commit 9713aa4
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,65 @@ The short code has the following configuration options.

`[wplibcalhours location="Parnassus Library" num_weeks=1]` - Prints the opening hours for the "Parnassus Library" for the next week (starting today).

## API

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.

#### Example payload

Three locations, the current date is January 3rd.

```json
{
"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"
}
// ...
]
}
```

## Styling

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.
Expand Down

0 comments on commit 9713aa4

Please sign in to comment.