Using the developer API

Using the developer API

If you need some custom logic, you can use the public API exposed by the plugin. You can use the calls below throughout your WordPress website.

Note: this article is about the API for the premium version. The free version has a similar API, just replace MBHIPRO() with MBHILITE()

API Calls

MBHIPRO()->is_open('location name')

Returns true if the location is currently open. False otherwise.

 

MBHIPRO()->is_closed('location name')

Returns true if the location is currently closed. False otherwise.

 

MBHIPRO()->get_opening_hours('location name')

Returns an array of objects containing the location’s opening hours.

 

MBHIPRO()->get_specials('location name')

Returns an array of objects containing the location’s special opening hours.

 

MBHIPRO()->get_vacations('location name')

Returns an array of objects containing the location’s vacations.

 

MBHIPRO()->get_opening_hours_on('location name', $aDateTimeObject) (premium only)

Returns the opening hours for a given date. Returns false if the location is closed that day.µ

 

MBHIPRO()->get_location_names() (premium only)

Returns an array of strings with all your location names.

 

MBHIPRO()->get_location('location name') (premium only)

Returns a location object for the given name.

 

Share