Skip to content
WXP Plugins

Plugins

WXP Restaurant Menu

WXP Opening Times

WXP Local Events

WXP Restaurant Reservations

Demo

Pricing

Support

Docs

FAQ

Buy

Menu

Plugins

- WXP Restaurant Menu

- WXP Opening Times

- WXP Local Events

- WXP Restaurant Reservations

Demo

Pricing

Support

- Docs

- FAQ

Buy

WXP Opening Times

8
  • Installation
    • Installing WXP Opening Times
  • Basic operations
    • Creating your (first) schedule
    • Setting exceptions
  • For developers
    • Filter- and action hooks
    • Twig templates
    • WXP Opening Times shortcodes
  • Jewish and Islamic holidays
    • Installation
      • Installing WXP Opening Times: Jewish and Islamic holidays
    • For developers
      • Jewish and Islamic holidays: for developers

WXP Restaurant Menu

11
  • Installation
    • Installing WXP Restaurant Menu
  • Basic operations
    • Understanding the concept
    • The Settings for the WXP Restaurant Menu Plugin
    • The Icon menu
    • The Sets Menu
    • The Tags Menu
    • The Groups Menu
    • The Categories menu
  • For developers
    • Filter- and action hooks
    • Twig templates
    • WXP Restaurant Menu shortcodes

WXP Local Events

8
  • Installation
    • Installing WXP Local Events
  • For developers
    • Filter- and action hooks
    • Twig templates
    • WXP Local Events shortcodes
  • Local Events for WooCommerce
    • Installation
      • Installing WXP Local Events for WooCommerce
    • For developers
      • Local Events for WooCommerce: for developers
  • Events Feed
    • Installation
      • Installing WXP Events Feed
    • For developers
      • Events Feed: for developers

WXP Restaurant Reservations

6
  • Installation
    • Installing WXP Restaurant Reservations
  • For developers
    • Filter- and action hooks
    • Twig templates
    • WXP Restaurant Reservations shortcodes
  • Rooms
    • Installation
      • Installing WXP Restaurant Bookings: Rooms
    • For developers
      • Rooms: for developers

General Developer Information

1
  • Twig
    • Twig templates in the WXP plugins

WXP Agency Kit

1
  • WXP Agency Kit: demo content from the command line
View Categories
  • Home
  • Documentation
  • WXP Opening Times
  • For developers
  • Filter- and action hooks

Filter- and action hooks

3 min read

0:00 / 4:48
  • View as Markdown Open this page as plain Markdown (opens in a new tab)
  • Open in ChatGPT Ask questions about this page (opens in a new tab)
  • Open in Claude Ask questions about this page (opens in a new tab)
  • Open in Google AI Studio Ask questions about this page (Google account required) (opens in a new tab)

WXP Opening Times offers filters to change the status it reports, the templates, the stylesheet, the structured data and the holiday calendars. It has no action hooks. All names start with wxp_opening_times_.

How to use a hook #

A filter receives a value, can change it and must return it. An action tells you that something happened, and returns nothing. Add your code to the functions.php of your child theme, or to a small plugin of your own. The last number of add_filter() and add_action() is the number of arguments your function receives; ask for as many as you need.

add_filter( 'hook_name', function ( $value, $extra ) {
	// Change $value here.
	return $value;
}, 10, 2 );

add_action( 'hook_name', function ( $first, $second ) {
	// React here.
}, 10, 2 );

Overview #

Hook Type What it does
wxp_opening_times_status Filter Changes the status returned by wxp_opening_times_get_status() and wxp_opening_times_is_open().
wxp_opening_times_holidays Filter Changes the holiday providers, for example to add Islamic or Jewish holidays. The bundled secular and Christian providers come first.
wxp_opening_times_schema Filter Changes the structured data (JSON-LD) of a schedule, for example to set a more specific type such as Restaurant or to add an address. Also used by wxp_opening_times_get_schema().
wxp_opening_times_schema_days Filter Changes how many days ahead the exceptions (periods and holidays) are added to the structured data.
wxp_opening_times_template_context Filter Changes the data that is passed to a Twig template, so you can use extra values in your own template.
wxp_opening_times_template_paths Filter Changes the folders where templates are looked for, in lookup order. The folders of your (child) theme come before the templates folder of the plugin.
wxp_opening_times_twig_cache Filter Sets a folder for the compiled templates. Caching is off by default, so no files are written.
wxp_opening_times_load_css Filter Decides whether the plugin loads its own stylesheet. Return false to use your own CSS.

Status and holidays #

wxp_opening_times_status #

Filter. Changes the status returned by wxp_opening_times_get_status() and wxp_opening_times_is_open().

Argument Type Description
$status array open (bool), closes_at, opens_at, next_change (Unix times or null) and schedule (the id).
$schedule Schedule The schedule that was checked.
$moment DateTimeImmutable The moment that was checked, in the time zone of the site.

Return: the status array.

wxp_opening_times_holidays #

Filter. Changes the holiday providers, for example to add Islamic or Jewish holidays. The bundled secular and Christian providers come first.

Argument Type Description
$providers array Provider objects that implement the HolidayProviderInterface of the plugin.

Return: the list of providers. Add your own provider object to the list.

Structured data (schema.org) #

wxp_opening_times_schema #

Filter. Changes the structured data (JSON-LD) of a schedule, for example to set a more specific type such as Restaurant or to add an address. Also used by wxp_opening_times_get_schema().

Argument Type Description
$data array The JSON-LD data.
$schedule Schedule The schedule.

Return: the data. Return an empty value to print nothing.

add_filter( 'wxp_opening_times_schema', function ( array $data ) {
	$data['@type']   = 'Restaurant';
	$data['address'] = 'Main Street 1, Amsterdam';
	return $data;
} );

wxp_opening_times_schema_days #

Filter. Changes how many days ahead the exceptions (periods and holidays) are added to the structured data.

Argument Type Description
$days int Number of days, 365 by default. The minimum is 1.
$schedule Schedule The schedule.

Return: the number of days.

Templates and stylesheet #

wxp_opening_times_template_context #

Filter. Changes the data that is passed to a Twig template, so you can use extra values in your own template.

Argument Type Description
$context array The template data.
$name string The name of the template.
$schedule Schedule The schedule that is shown.

Return: the template data.

wxp_opening_times_template_paths #

Filter. Changes the folders where templates are looked for, in lookup order. The folders of your (child) theme come before the templates folder of the plugin.

Argument Type Description
$paths string[] Folders.

Return: the list of folders.

add_filter( 'wxp_opening_times_template_paths', function ( array $paths ) {
	array_unshift( $paths, WP_CONTENT_DIR . '/my-opening-times-templates' );
	return $paths;
} );

wxp_opening_times_twig_cache #

Filter. Sets a folder for the compiled templates. Caching is off by default, so no files are written.

Argument Type Description
$cache string|false A folder, or false (default).

Return: a folder, or false.

wxp_opening_times_load_css #

Filter. Decides whether the plugin loads its own stylesheet. Return false to use your own CSS.

Argument Type Description
$load bool true by default.

Return: true or false.

add_filter( 'wxp_opening_times_load_css', '__return_false' );

Good to know #

  • Helper functions: to read the opening times from your own code, see the functions wxp_opening_times_is_open(), wxp_opening_times_get_status(), wxp_opening_times_get_day(), wxp_opening_times_get_weekly(), wxp_opening_times_get_holidays(), wxp_opening_times_get_schedules() and wxp_opening_times_get_schema().
  • Priority: add your filters from your theme or from a plugin. They run every time the value is needed, so keep them light.
Updated on October 30, 2026

What are your Feelings

  • Happy
  • Normal
  • Sad

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
WXP Opening Times shortcodesTwig templates
Table of Contents
  • How to use a hook
  • Overview
  • Status and holidays
    • wxp_opening_times_status
    • wxp_opening_times_holidays
  • Structured data (schema.org)
    • wxp_opening_times_schema
    • wxp_opening_times_schema_days
  • Templates and stylesheet
    • wxp_opening_times_template_context
    • wxp_opening_times_template_paths
    • wxp_opening_times_twig_cache
    • wxp_opening_times_load_css
  • Good to know
WXP Plugins

Demo

Pricing

© 2026 WXP Plugins. All prices are in euro, excluding VAT.

WXPPlugins is a brand of WP Digital Marketing - The Netherlands - Chamber of Commerce (KvK) 75580152