WXP Local Events offers filters to change the event pages, the reservations and who may manage them, the mails, the structured data, the templates and the editor of the event description. Payment add-ons use the payment hooks. All names start with wxp_local_events_.
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_local_events_reservation_created |
Action | Fires after a reservation was made. |
wxp_local_events_reservation_status_changed |
Action | Fires after the status of a reservation changed. A rejected reservation has reject_reason and reject_message in its row. |
wxp_local_events_reservation_paid |
Action | Fires after the payment of a reservation arrived. A payment add-on reports a payment with ReservationService::mark_paid(). |
wxp_local_events_reservation_paid_late |
Action | Fires when the payment arrives after the reservation was cancelled or rejected. The seats were released already, so the venue has to decide: refund, or bring the reservation back. |
wxp_local_events_mail_enabled |
Filter | Decides whether a mail is sent. |
wxp_local_events_mail_message |
Filter | Changes the message before it is sent. |
wxp_local_events_mail_sent |
Action | Fires after a mail was handed to wp_mail(). |
wxp_local_events_manage_reservations_cap |
Filter | Changes the capability needed to see and handle reservations. They hold personal data, so by default only editors and above can. |
wxp_local_events_client_id |
Filter | Changes the identifier used for the rate limit of the public reservation form. Behind a proxy, return the address of the real visitor. |
wxp_local_events_form_user |
Filter | Changes the values the reservation form is prefilled with for a logged in user. |
wxp_local_events_csv_delimiter |
Filter | Changes the delimiter of the CSV export of reservations. The default is a semicolon for the languages whose Excel expects it, and a comma otherwise. |
wxp_local_events_date_flags |
Filter | Changes the warnings of a date of an event, such as a holiday or a closed day. |
wxp_local_events_payment_methods |
Filter | Registers online payment methods that can be chosen for a paid event. |
wxp_local_events_payment_url |
Filter | Gives the address where the guest pays a new reservation of an event that is paid online. The payment add-on answers this filter. |
wxp_local_events_order_url |
Filter | Gives the link to the order of a reservation that was paid online. It is shown with the reservation. The payment add-on sets it. |
wxp_local_events_currency_source |
Filter | Names the plugin that decides the currency, such as WooCommerce. The currency fields on the settings page are then read-only. |
wxp_local_events_currency_symbol |
Filter | Changes the currency symbol shown with event prices. |
wxp_local_events_currency_code |
Filter | Changes the ISO 4217 currency code, used in the structured data and on the settings page. |
wxp_local_events_demo_event_created |
Action | Fires after the importer has created a demo event with all its fields, so that a payment add-on can set up what the event needs, such as a ticket product. |
wxp_local_events_slug |
Filter | Changes the first part of the address of the event pages. Save the permalinks again after you change it. |
wxp_local_events_single_layout |
Filter | Changes the layout of the page of an event. |
wxp_local_events_single_content |
Filter | Decides whether the plugin adds its details and reservation form to the page of an event. Return false if your theme template prints them itself. |
wxp_local_events_single_extra |
Filter | Adds extra details to the page of an event. They reach the template as acf. |
wxp_local_events_elementor_frame |
Filter | Decides whether the page of an event is printed with the Elementor header and footer chosen in the settings. |
wxp_local_events_feed_items |
Filter | Changes the dates in the public event feed, which other websites can read. |
wxp_local_events_json_ld |
Filter | Decides whether the structured data of an event is printed. Return false if an SEO plugin already prints it. |
wxp_local_events_json_ld_place |
Filter | Changes the place of the events: a schema.org Place. By default the name and address of the settings are used, and the site name when those are empty. |
wxp_local_events_json_ld_data |
Filter | Changes the structured data of an event. |
wxp_local_events_template_context |
Filter | Changes the data passed to a template. |
wxp_local_events_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_local_events_twig_cache |
Filter | Sets a folder for the compiled templates. Caching is off by default. |
wxp_local_events_load_css |
Filter | Decides whether the plugin loads its own stylesheet. Return false to use your own CSS. |
wxp_local_events_allowed_blocks |
Filter | Changes the blocks that can be used in the description of an event. Blocks of other plugins are not loaded on this screen: register a custom block with a script (see the next hook) and add its name here. |
wxp_local_events_editor_script_handles |
Filter | Adds script handles that must load before the admin app, such as the script that registers a custom block. |
wxp_local_events_enqueue_editor_assets |
Action | Fires on the events admin screen, so your custom blocks can enqueue their editor scripts. Add the block names with wxp_local_events_allowed_blocks. |
wxp_local_events_default_start_time |
Filter | Changes the start time a new event date starts with in the editor. |
Actions: reservations #
wxp_local_events_reservation_created #
Action. Fires after a reservation was made.
| Argument | Type | Description |
|---|---|---|
$id |
int | The reservation id. |
$reservation |
array | The stored row. |
add_action( 'wxp_local_events_reservation_created', function ( int $id, array $reservation ) {
// Tell your own system about the new reservation.
}, 10, 2 );
wxp_local_events_reservation_status_changed #
Action. Fires after the status of a reservation changed. A rejected reservation has reject_reason and reject_message in its row.
| Argument | Type | Description |
|---|---|---|
$id |
int | The reservation id. |
$old |
string | The old status. |
$status |
string | The new status. |
$row |
array | The stored row. |
$actor |
string | admin or guest. |
wxp_local_events_reservation_paid #
Action. Fires after the payment of a reservation arrived. A payment add-on reports a payment with ReservationService::mark_paid().
| Argument | Type | Description |
|---|---|---|
$id |
int | The reservation id. |
$row |
array | The stored row. |
wxp_local_events_reservation_paid_late #
Action. Fires when the payment arrives after the reservation was cancelled or rejected. The seats were released already, so the venue has to decide: refund, or bring the reservation back.
| Argument | Type | Description |
|---|---|---|
$id |
int | The reservation id. |
$row |
array | The stored row. |
Mail #
wxp_local_events_mail_enabled #
Filter. Decides whether a mail is sent.
| Argument | Type | Description |
|---|---|---|
$send |
bool | true by default. |
$type |
string | The mail type. |
$row |
array | The reservation. |
Return: true to send, false to skip.
wxp_local_events_mail_message #
Filter. Changes the message before it is sent.
| Argument | Type | Description |
|---|---|---|
$message |
array | to, subject, body (HTML) and headers. |
$type |
string | The mail type. |
$row |
array | The reservation. |
Return: the message.
wxp_local_events_mail_sent #
Action. Fires after a mail was handed to wp_mail().
| Argument | Type | Description |
|---|---|---|
$type |
string | The mail type. |
$row |
array | The reservation. |
$sent |
bool | Whether wp_mail() accepted the mail. |
Reservations: access and protection #
wxp_local_events_manage_reservations_cap #
Filter. Changes the capability needed to see and handle reservations. They hold personal data, so by default only editors and above can.
| Argument | Type | Description |
|---|---|---|
$capability |
string | edit_others_posts by default. |
Return: a capability.
add_filter( 'wxp_local_events_manage_reservations_cap', function () {
return 'manage_options';
} );
wxp_local_events_client_id #
Filter. Changes the identifier used for the rate limit of the public reservation form. Behind a proxy, return the address of the real visitor.
| Argument | Type | Description |
|---|---|---|
$ip |
string | The remote address. |
Return: the address.
wxp_local_events_form_user #
Filter. Changes the values the reservation form is prefilled with for a logged in user.
| Argument | Type | Description |
|---|---|---|
$values |
array | first_name, last_name and email. Empty for visitors. |
Return: the values.
wxp_local_events_csv_delimiter #
Filter. Changes the delimiter of the CSV export of reservations. The default is a semicolon for the languages whose Excel expects it, and a comma otherwise.
| Argument | Type | Description |
|---|---|---|
$delimiter |
string | The delimiter. |
Return: the delimiter.
wxp_local_events_date_flags #
Filter. Changes the warnings of a date of an event, such as a holiday or a closed day.
| Argument | Type | Description |
|---|---|---|
$flags |
array | A list of warnings, each with type and label. |
$start |
DateTimeImmutable | The start of the date. |
Return: the list of warnings.
Payment add-ons #
wxp_local_events_payment_methods #
Filter. Registers online payment methods that can be chosen for a paid event.
| Argument | Type | Description |
|---|---|---|
$methods |
array | Slug => array with label (shown in the editor) and pay_text (shown to guests). Empty by default. |
Return: the methods.
add_filter( 'wxp_local_events_payment_methods', function ( array $methods ) {
$methods['my-gateway'] = array(
'label' => 'My gateway',
'pay_text' => 'You pay online after you reserve.',
);
return $methods;
} );
wxp_local_events_payment_url #
Filter. Gives the address where the guest pays a new reservation of an event that is paid online. The payment add-on answers this filter.
| Argument | Type | Description |
|---|---|---|
$url |
string | The payment address. Empty when the add-on cannot take the payment, which cancels the reservation. |
$id |
int | The reservation id. |
$reservation |
array | The stored row. |
Return: the payment address.
wxp_local_events_order_url #
Filter. Gives the link to the order of a reservation that was paid online. It is shown with the reservation. The payment add-on sets it.
| Argument | Type | Description |
|---|---|---|
$url |
string | The link, empty by default. |
$order_id |
int | The order. |
Return: the link.
wxp_local_events_currency_source #
Filter. Names the plugin that decides the currency, such as WooCommerce. The currency fields on the settings page are then read-only.
| Argument | Type | Description |
|---|---|---|
$source |
string | The name, empty by default. |
Return: the name.
wxp_local_events_currency_symbol #
Filter. Changes the currency symbol shown with event prices.
| Argument | Type | Description |
|---|---|---|
$symbol |
string | The symbol; the euro sign unless set in the settings. |
Return: the symbol.
wxp_local_events_currency_code #
Filter. Changes the ISO 4217 currency code, used in the structured data and on the settings page.
| Argument | Type | Description |
|---|---|---|
$code |
string | The code; EUR unless set in the settings. |
Return: the code.
wxp_local_events_demo_event_created #
Action. Fires after the importer has created a demo event with all its fields, so that a payment add-on can set up what the event needs, such as a ticket product.
| Argument | Type | Description |
|---|---|---|
$event_id |
int | The event. |
Event pages #
wxp_local_events_slug #
Filter. Changes the first part of the address of the event pages. Save the permalinks again after you change it.
| Argument | Type | Description |
|---|---|---|
$slug |
string | events by default, without slashes. |
Return: the slug.
add_filter( 'wxp_local_events_slug', function () {
return 'agenda';
} );
wxp_local_events_single_layout #
Filter. Changes the layout of the page of an event.
| Argument | Type | Description |
|---|---|---|
$layout |
string | standard, picture, card or compact. |
$event_id |
int | The event. |
Return: the layout.
wxp_local_events_single_content #
Filter. Decides whether the plugin adds its details and reservation form to the page of an event. Return false if your theme template prints them itself.
| Argument | Type | Description |
|---|---|---|
$enabled |
bool | true by default. |
Return: true or false.
wxp_local_events_single_extra #
Filter. Adds extra details to the page of an event. They reach the template as acf.
| Argument | Type | Description |
|---|---|---|
$extra |
array | Empty by default. |
$event_id |
int | The event. |
Return: the extra details.
wxp_local_events_elementor_frame #
Filter. Decides whether the page of an event is printed with the Elementor header and footer chosen in the settings.
| Argument | Type | Description |
|---|---|---|
$enabled |
bool | true by default. |
Return: true or false.
wxp_local_events_feed_items #
Filter. Changes the dates in the public event feed, which other websites can read.
| Argument | Type | Description |
|---|---|---|
$items |
array | The dates, as listed in the response. |
Return: the dates.
Structured data (schema.org) #
wxp_local_events_json_ld #
Filter. Decides whether the structured data of an event is printed. Return false if an SEO plugin already prints it.
| Argument | Type | Description |
|---|---|---|
$enabled |
bool | true by default. |
Return: true or false.
add_filter( 'wxp_local_events_json_ld', '__return_false' );
wxp_local_events_json_ld_place #
Filter. Changes the place of the events: a schema.org Place. By default the name and address of the settings are used, and the site name when those are empty.
| Argument | Type | Description |
|---|---|---|
$place |
array | The Place data. |
Return: the place.
wxp_local_events_json_ld_data #
Filter. Changes the structured data of an event.
| Argument | Type | Description |
|---|---|---|
$data |
array | The data. |
$event_id |
int | The event. |
Return: the data.
Templates and stylesheet #
wxp_local_events_template_context #
Filter. Changes the data passed to a template.
| Argument | Type | Description |
|---|---|---|
$context |
array | The template data. |
$template |
string | The name of the template. |
Return: the template data.
wxp_local_events_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.
wxp_local_events_twig_cache #
Filter. Sets a folder for the compiled templates. Caching is off by default.
| Argument | Type | Description |
|---|---|---|
$cache |
string|false | A folder, or false (default). |
Return: a folder, or false.
wxp_local_events_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_local_events_load_css', '__return_false' );
Editor of the event description #
wxp_local_events_allowed_blocks #
Filter. Changes the blocks that can be used in the description of an event. Blocks of other plugins are not loaded on this screen: register a custom block with a script (see the next hook) and add its name here.
| Argument | Type | Description |
|---|---|---|
$blocks |
string[] | Block names. |
Return: the block names.
wxp_local_events_editor_script_handles #
Filter. Adds script handles that must load before the admin app, such as the script that registers a custom block.
| Argument | Type | Description |
|---|---|---|
$handles |
string[] | Script handles, none by default. |
Return: the handles.
wxp_local_events_enqueue_editor_assets #
Action. Fires on the events admin screen, so your custom blocks can enqueue their editor scripts. Add the block names with wxp_local_events_allowed_blocks.
wxp_local_events_default_start_time #
Filter. Changes the start time a new event date starts with in the editor.
| Argument | Type | Description |
|---|---|---|
$time |
string | 20:00 by default. |
Return: a time, hours and minutes.
Good to know #
- Rows: the reservation hooks pass the stored row as an array, not as an object.
- Events Feed: the companion plugin WXP Events Feed reads the public feed that
wxp_local_events_feed_itemschanges. - Personal data: reservations hold names and e-mail addresses. Be careful with what you send to other systems from these actions.