The add-on has no hooks of its own. It uses the holiday filter of WXP Opening Times to add two providers, one for the Jewish and one for the Islamic holidays. Everything else follows from that.
How it plugs in #
WXP Opening Times builds its list of holidays with the filter wxp_opening_times_holidays. The bundled secular and Christian providers come first. This add-on adds its two providers to that list. See Filter- and action hooks of WXP Opening Times for the arguments of the filter.
| Item | Value |
|---|---|
| Filter used | wxp_opening_times_holidays (a filter of WXP Opening Times) |
| Providers added | Jewish holidays and Islamic holidays |
| Minimum version of WXP Opening Times | 0.11.0 (holidays with more than one date a year) |
| Settings option | wxp_opening_times_holidays_settings |
| Settings page | admin.php?page=wxp-opening-times-holidays, a sub page of Opening times |
| Text domain | wxp-opening-times-jewish-and-islamic-holidays |
Add your own holidays #
You can add holidays in the same way. A provider is an object that implements the HolidayProviderInterface of WXP Opening Times. Add yours to the list in a filter:
add_filter( 'wxp_opening_times_holidays', function ( $providers ) {
if ( is_array( $providers ) ) {
$providers[] = new My_Local_Holidays(); // Implements HolidayProviderInterface.
}
return $providers;
} );
Good to know #
- No external calls: all dates are calculated on the server. The Jewish dates are exact, because the Hebrew calendar is arithmetic. The Islamic dates use Umm al-Qura (needs the PHP intl extension) or the tabular calendar, and the settings can shift all holidays of a month by one or two days.
- When the add-on is off: rules that use its holidays stay in the schedule, show as “not available” and do nothing.
- Nothing on your pages: the add-on adds no front-end output, scripts or styles.
- Translations: English, Dutch (informal and formal), German and French are included, and the plugin is ready for translation on translate.wordpress.org.