# Plugin customization

In order to facilitate customization different filters and actions have been created. We recommend that you insert your customization code in the **functions.php of your child theme** to make sure it is not erase on plugin or theme update.

<a id="filters-for-the-accommodation-type-post"></a>

## Filters for the accommodation type post

- hb\_accommodation\_cpt
- hb\_accommodation\_public
- [hb\_accommodation\_has\_archive](#hb-accommodation-has-archive)
- [hb\_accommodation\_supports](#hb-accommodation-supports)
- [hb\_accommodation\_taxonomies](#hb-accommodation-taxonomies)

<a id="filters-for-the-search-form"></a>

## Filters for the search form

- [hb\_search\_form\_markup](#hb-search-form-markup)
- [hb\_search\_form\_title](#hb-search-form-title)

<a id="filters-for-the-accommodation-selection"></a>

## Filters for the accommodation selection

- hb\_available\_accommodation\_markup
- hb\_first\_available\_accom\_num

<a id="filters-for-the-extra-services-selection"></a>

## Filters for the extra-services selection

- [hb\_extra\_name](#hb-extra-name)
- [hb\_resa\_extra\_formatting](#hb-resa-extra-formatting)
- [hb\_extras\_types\_order](#hb_extras_types_order)
- [hb\_extras\_form\_markup](#hb-extras-form-markup)

<a id="filters-for-the-details-form"></a>

## Filters for the details form

These filters can be useful if you wish to add content **before or after a specific field**:

- hb\_details\_form\_markup\_before\_field
- hb\_details\_form\_markup\_after\_field

This filter can be useful if you wish to **modify** a specific **field output**:

- [hb\_details\_form\_markup\_field](#hb-details-form-markup-field)

This filter can be useful if you wish to **modify** the output of the **details form**:

- [hb\_details\_form\_markup](#hb-details-form-markup)

<a id="filters-for-the-payment-section"></a>

## Filters for the payment section

- [hb\_payment\_types](#hb_payment_types)
- [hb\_active\_payment\_gateways](#hb_active_payment_gateways)
- [hb\_stripe\_credit\_cards\_icons](#hb_stripe_credit_cards_icons)

<a id="filters-for-the-summary-and-book-now-area"></a>

## Filters for the summary and book now area

- hb\_resa\_summary\_markup
- hb\_resa\_summary\_no\_external\_payment\_markup
- hb\_resa\_summary\_external\_payment\_markup
- [hb\_policies\_area\_markup](#hb-policies-area-markup)
- hb\_confirm\_area\_markup

<a id="filters-for-the-invoice-table"></a>

## Filters for the invoice table

- [hb\_invoice\_table\_style](#hb-invoice-table-style)
- hb\_invoice\_table\_markup

<a id="filters-for-the-actions-associated-to-the-reservation-and-customer"></a>

## Filters for the actions associated to the reservation and customer

- [hb\_create\_reservation](#hb-create-reservation)
- [hb\_create\_customer](#hb-create-customer)
- [hb\_reservations\_updated](#hb-reservations-updated)
- [hb\_blocked\_accom\_updated](#hb-blocked-accom-updated)

<a id="filters-for-the-shorcodes-hb_accommodation_list-hb_rates-hb_availability"></a>

## Filters for the shorcodes \[hb\_accommodation\_list\], \[hb\_rates\], \[hb\_availability\]

- [hb\_accommodation\_list\_markup](#hb-accommodation-list-markup)
- hb\_rates\_markup
- hb\_availability\_on\_click\_refresh

<a id="filters-for-hbook-additional-roles-reservation-reader-reservation-manager-pricing-manager-hbook-manager"></a>

## Filters for HBook additional roles (reservation reader, reservation manager, pricing manager, HBook manager)

- hb\_resa\_reader\_capabilities
- [hb\_resa\_manager\_capabilities](#hb-resa-manager-capabilities)
- hb\_pricing\_manager\_capabilities
- hb\_hbook\_manager\_capabilities

<a id="filters-for-automatic-emails"></a>

## Filters for automatic emails

- [hb\_email\_actions](#hb-email-actions) : to add actions upon which an email is sent automatically
- [hb\_scheduled\_min\_hour](#hb-scheduled-min-hour) : to change the sending window minimum hour of the day
- [hb\_scheduled\_max\_hour](#hb-scheduled-max-hour) : to change the sending window maximum hour of the day. Default is 11pm

<a id="filters-for-the-ical-sync"></a>

## Filters for the iCal sync

- [hb\_ical\_agenda\_check\_in\_time](#hb-ical-agenda-check-in-time) : to change the shared check-in time when using the “agenda” query parameter. Default is 3pm.
- [hb\_ical\_agenda\_check\_out\_time](#hb-ical-agenda-check-out-time) : to change the shared check-out time when using the “agenda” query parameter. Default is 11am.
- [hb\_ical\_additional\_info](#hb-ical-additional-info) : to add information to filter the “DESCRIPTION” field when importing a iCal calendar event. The filtered information will be displayed in the “Comments” column for the reservation.
- [hb\_ical\_additional\_non\_standard\_properties](#hb-ical-additional-non-standard-properties) : to add information to filter any non standard property (“X-PROPERTY-NAME”) field when importing a iCal calendar event. The filtered information will be displayed in the “Comments” column for the reservation.
- [hb\_ical\_nb\_years\_history](#hb-ical-nb-years-history) : to customize the number of years in the past that are included in the export when passing the query parameter “future\_only” to “no”. Default is 2 years.

<a id="various"></a>

## Various

- [hb\_language\_list](#hb-language-list)
- [hb\_uncompleted\_resa\_deletion\_delay](#hb-uncompleted-resa-deletion-delay)
- [hb\_old\_resa\_logs\_deletion\_delay](#hb-old-resa-logs-deletion-delay)
- [hb\_retina\_scale\_factor](#hb-retina-scale-factor)
- [hb\_image\_sizes](#hb-image-sizes)
- [hb\_strings](#hb-strings)

<a id="js-functions"></a>

## Js functions

HBook plugin also try to call these two global JavaScript functions:

- [hbook\_show\_accom\_list](#hbook-show-accom-list)
- [hbook\_reservation\_done](#hbook-reservation-done)

* * *

<a id="hb_accommodation_taxonomies"></a>

#### hb\_accommodation\_taxonomies

This filter is applied to the **taxonomies** parameter which is passed to the **register\_post\_type** function used for creating the Accommodation custom post type.

**Parameter:**

- **$taxonomies:** *(array)* list of taxonomies.

**Example:**  
Adding categories to the Accommodation posts.

```
function categories_for_accommodation( $taxonomies ) {
	$taxonomies[] = 'category';
	return $taxonomies;
}
add_filter( 'hb_accommodation_taxonomies', 'categories_for_accommodation' );
```

Please note that by default posts using a custom post types are not included in archive pages. To add them (if you wish to have a page for a category for example), you will need to add the following code:

```
function hbook_add_custom_types( $query ) {
	if( (is_category() || is_tag()) && $query->is_archive() && empty( $query->query_vars['suppress_filters'] ) ) {
	$query->set( 'post_type', array(
	'post', 'hb_accommodation'
		));
	}
	return $query;
}
add_filter( 'pre_get_posts', 'hbook_add_custom_types' );
```

* * *

<a id="hb_accommodation_has_archive"></a>

#### hb\_accommodation\_has\_archive

This filter is applied to the **has\_archive** parameter which is passed to the **register\_post\_type** function used for creating the Accommodation custom post type.

**Parameter: none**

**Example:**  
To disable the archive for the accommodation post types:

```
function hb_disable_archive() {
	return false;
}
add_filter( 'hb_accommodation_has_archive', 'hb_disable_archive' );
```

* * *

<a id="hb_accommodation_supports"></a>

#### hb\_accommodation\_supports

This filter is applied to the **supports** parameter which is passed to the **register\_post\_type** function used for creating the Accommodation custom post type.

**Parameter:**

- **$supports:** *(array)* list of supported items.

**Example:**  
Adding support for excerpts to the Accommodation posts.

```
function support_for_excerpts( $supports ) {
	$supports[] = 'excerpt';
	return $supports;
}
add_filter( 'hb_accommodation_supports', 'support_for_excerpts' );
```

* * *

<a id="hb_search_form_markup"></a>

#### hb\_search\_form\_markup

This filter is applied to the HTML mark up of the form which is used for searching available accommodation.

**Parameters:**

- **$output:** *(string)* the HTML code of the form.
- **$form\_id:** *(string)* the id of the form as passed to the **\[hb\_booking\_form\]** shortcode via the **form\_id** attribute.

* * *

<a id="hb_search_form_title"></a>

#### hb\_search\_form\_title

This filter is applied to the title of the search form.

**Parameter:**

- **$title:** *(string)* the HTML code of the title of the search form.

**Example:**  

```
function change_title_tag( $title ) {
	return str_replace( 'h3', 'h2', $title );
}
add_filter( 'hb_search_form_title', 'change_title_tag' );
```

* * *

<a id="hb_extra_name"></a>

#### hb\_extra\_name

This filter is applied to the name of each extra service (extra services are displayed as a list after the accommodation selection).

**Parameter:**

- $display\_name, $option, $price
- **$display\_name:** *(string)* name of the extra as it will be displayed
- **$extra:** *(array)* information about the extra
- **$price:** *(array)* price of the extra

* * *

<a id="hb_resa_extra_formatting"></a>

#### hb\_resa\_extra\_formatting

This filter is applied to the name of each chosen extra service (in emails sent by HBook).

**Parameter:**

- **$formatted\_extra\_name:** *(string)* the formatted name of the extra service
- **$extra\_name:** *(string)* the name of the extra service
- **$extra\_value:** *(string)* value of the chosen option
- **$option\_choice\_name:** *(string)* name of the chosen option

* * *

<a id="hb_extras_types_order"></a>

#### hb\_extras\_types\_order

The extra-services are grouped by type of input (checkbox, select drop-down, radio buttons).

- The **single** options are displayed with checkboxes : these are for extra-services that are not quantities and for which there is no multiple choices.
- The **quantity** options are displayed with a drop-down select : these are for extra-services that are quantities (per day, per person/per day, etc.)
- The **multiple** options are displayed with radio buttons : these are for extra-services that have multiple choices.

The default display order is : single, quantity, multiple. This filter is useful to have a different order of display of the different types of extra-services.

**Parameter:**

- **$types:** *(array)* list of the different types, by order of display. Default order is : array( 'single', 'quantity', 'multiple' ).

**Example:**  
Changing the default order to display drop-down select first (quantity), then checkboxes(single) and finally all options that are with radio buttons(multiple):

```
function custom_extras_types_order( $types ) {
	$types = array( 'quantity', 'single', 'multiple' );
	return $types;
}
add_filter( 'hb_extras_types_order', 'custom_extras_types_order' );
```

* * *

<a id="hb_extras_form_markup"></a>

#### hb\_extras\_form\_markup

This filter is applied to the HTML mark up of the form which displays extra services.

**Parameter:**

- **$output:** *(string)* the HTML code of the form.

* * *

<a id="hb_details_form_markup_field"></a>

#### hb\_details\_form\_markup\_field

This filter is applied to the HTML mark up of a field of details fields.

**Parameter:**

- **$output:** *(string)* the HTML code of for the specific field.
- **$field:** *(array)* the attributes of the field.

**Example:**

Set a default input field value. In this example, it is a default arrival time, for a field that is for admin use only.

```
add_filter( 'hb_details_form_markup_field', 'myfunction_set_default_arrival_time', 10, 2 );

function myfunction_set_default_arrival_time( $markup, $field ) {
    if ( $field['id'] == 'arrival_time' ) {
        $markup = str_replace( 'value=""', 'value="15:00"', $markup );
    }
    return $markup;
}
```

* * *

<a id="hb_details_form_markup"></a>

#### hb\_details\_form\_markup

This filter is applied to the HTML mark up of the form which is used for getting the details fields.

**Parameter:**

- **$output:** *(string)* the HTML code of the form.

* * *

<a id="hb_payment_types"></a>

#### hb\_payment\_types

This filter is applied to the set an order for the payment types listed when a choice is offered to the customer.

**Parameter:**

- **$types:** *(array)* list of accepted payment types. Default order is : array( 'offline', 'store\_credit\_card', 'deposit', 'full' ).

**Example:**  
Changing the default order to have the offline option as last one.

```
function custom_payment_type_order( $types ) {
	$types = array( 'deposit', 'full', 'store_credit_card', 'offline' );
	return $types;
}
add_filter( 'hb_payment_types', 'custom_payment_type_order' );
```

* * *

<a id="hb_active_payment_gateways"></a>

#### hb\_active\_payment\_gateways

This filter is applied to the list of payment gateways that have been activated.

**Parameter:**

- **$gateways:** *(array)* list of active payment types.

**Example:**  
Reverse the order of the payment gateways options, in the payment form, when various are enabled.

```
function custom_payment_gateway_order( $gateways ) {
	$gateways = array_reverse( $gateways );
	return $gateways;
}
add_filter( 'hb_active_payment_gateways', 'custom_payment_gateway_order' );
```

* * *

<a id="hb_stripe_credit_cards_icons"></a>

#### hb\_stripe\_credit\_cards\_icons

This filter is applied to the set which credit card icons you wish to display in the Stripe payment form.

**Parameter:**

- **$icons:** *(array)* list of credit card icons. Default value is : array( 'mastercard', 'visa', 'americanexpress' ). Possible values are : 'amazon', 'americanexpress', 'delta', ''diners', discover', 'ebay', ''jcb', maestro', 'mastercard', 'solo', 'visa', 'visaelectron', 'switch'

**Example:**  
Display only visa and mastercard icons.

```
function custom_stripe_payment_icons( $types ) {
	$icons = array( 'visa', 'mastercard' );
	return $icons;
}
add_filter( 'hb_stripe_credit_cards_icons', 'custom_stripe_payment_icons' );
```

* * *

<a id="hb_policies_area_markup"></a>

#### hb\_policies\_area\_markup

This filter is applied to the part of the booking form where customers aknowledge Privacy policy, Terms and conditions.

**Parameter:**

- **$output:** *(string)* the HTML code of the form.

**Example:**  
Add a checkbox to signup to a MailChimp newsletter. This requires MC4WP plugin and custom integration. Please check [this article](https://maestrel.com/knowledgebase/?article=134) of our knowledgebase.

```
function add_mailchimp_to_details_form( $output ) {
    $output .= '<h3 class="hb-title hb-title-terms">Our newsletter</h3>';
    $output .= '<p>';
    $output .= '<label>';
    $output .= '<input type="checkbox" name="mc4wp-subscribe" value="1" />';
    $output .= 'Yes! Subscribe me to the your monthly newsletter.</label>';
    $output .= '</p>';
    return $output;
}

add_filter( 'hb_policies_area_markup', 'add_mailchimp_to_details_form' );
```

* * *

<a id="hb_invoice_table_style"></a>

#### hb\_invoice\_table\_style

This filter is applied to the invoice table styles. You can find these styles in **wp-content/plugins/hbook/utils/utils.php**. Look for the function "get\_invoice\_table".

**Parameters**

- **$style:** *(string)* all the CSS applied.
- **$resa:** *(array)* the reservation information

* * *

<a id="hb_create_reservation"></a>

#### hb\_create\_reservation

This action fires when a new reservation is added to the reservation database table.

**Parameter:**

- **$resa\_info:** *(array)* all of the new reservation information.

* * *

<a id="hb_create_customer"></a>

#### hb\_create\_customer

This action fires when a new customer is added to the customer database table.

**Parameter:**

- **$customer\_info:** *(array)* all of the customer information.

* * *

<a id="hb_reservations_updated"></a>

#### hb\_reservations\_updated

This action fires whenever the reservations database table is updated.

**Parameter:** None.

* * *

<a id="hb_blocked_accom_updated"></a>

#### hb\_blocked\_accom\_updated

This action fires whenever the blocked accommodation database table is updated.

**Parameter:** None.

* * *

<a id="hb_accommodation_list_markup"></a>

#### hb\_accommodation\_list\_markup

This hook can be used to modify the display of the accommodation list.

**Parameter:**

- **$output:** *(string)* that contains the output of the accommodation list markup.

**Example:**  
For the accommodation list thumbnail to open the accommodation type post in the same tab.

In the functions.php of your child theme add:

```
function change_target_self( $output ) {
	return str_replace( '_blank', '_self', $output );
}
add_filter( 'hb_accommodation_list_markup', 'change_target_self' );
```

* * *

<a id="hb_resa_manager_capabilities"></a>

#### hb\_resa\_manager\_capabilities

This filter is applied to the list of capabilities of the reservation manager.

**Parameter:**

- **$capabilities:** *(array)* that contains a list of the different capabilities.

**Example:**  
If your theme redirect automatically the user with "read" capability to the front-end, you shoudl add capabilities that are for Contributor or Author, depending on your theme. To view a full list of WordPress roles and capabilities, please refer to [https://codex.wordpress.org/Roles\_and\_Capabilities](https://codex.wordpress.org/Roles_and_Capabilities)

```
function hb_add_capabiliites_to_manager( $capabilities ) {
	$added_capabilities = array( 'edit_posts', 'delete_pots' );
	$capabilities = array_merge( $added_capabilities, $capabilities );
	return $capabilities;
}
add_filter( 'hb_resa_manager_capabilities', 'hb_add_capabiliites_to_manager' );
```

* * *

<a id="hb_email_actions"></a>

#### hb\_email\_actions

This filter is applied to the list of actions that are shown in the column "Send on" of the email templates in **HBook > Emails**.

**Parameter:**

- **$actions:** *(array)* that contains information about the different actions : a key *(string)* => value *(string)*. Required keys are *'action\_value'* and *'action\_text'*.

* * *

<a id="hb_scheduled_min_hour"></a>

#### hb\_scheduled\_min\_hour

Automatics emails are triggered, by default, between 7am and 11pm (timezone set in WordPress Settings), as soon there is a visit on your website (admin or front-end).  
Default is 7 (7am). Expect a number between 0 and 23.

**Parameter:** None.

**Example:**

```
function change_minimum_scheduled_hour() {
	return 9;
}
add_filter( 'hb_scheduled_min_hour', 'change_minimum_scheduled_hour' );
```

* * *

<a id="hb_scheduled_max_hour"></a>

#### hb\_scheduled\_max\_hour

Automatics emails are triggered, by default, between 7am and 11pm (timezone set in WordPress Settings), as soon there is a visit on your website (admin or front-end).  
Default is 23 (11pm). Expect a number between 0 and 23.

**Parameter:** None.

**Example:**

```
function change_maximum_scheduled_hour() {
	return 20;
}
add_filter( 'hb_scheduled_max_hour', 'change_maximum_scheduled_hour' );
```

* * *

<a id="hb_ical_agenda_check_in_time"></a>

#### hb\_ical\_agenda\_check\_in\_time

If you are using the query parameter “agenda” to include times in the format of the shared information for DTSTART and DTEND iCal property, you may wish to modify the time passed to DTSTART (check-in time). By default, we pass “15” (3pm).

**Parameter:** None.

Default is 15 (3pm). Expect a number between 0 and 23.

```
function change_agenda_check_in_time() {
	return 16;
}
add_filter( 'hb_ical_agenda_check_in_time', 'change_agenda_check_in_time' );
```

* * *

<a id="hb_ical_agenda_check_out_time"></a>

#### hb\_ical\_agenda\_check\_out\_time

If you are using the query parameter “agenda” to include times in the format of the shared information for DTSTART and DTEND iCal property, you may wish to modify the time passed to DTEND (check-out time). By default, we pass “11” (11am).

**Parameter:** None.

Default is 11 (11am). Expect a number between 0 and 23.

```
function change_agenda_check_out_time() {
	return 10;
}
add_filter( 'hb_ical_agenda_check_out_time', 'change_agenda_check_out_time' );
```

* * *

<a id="hb_ical_additional_info"></a>

#### hb\_ical\_additional\_info

**Parameter:**

- **$default\_comment\_data:** *(array)* an array of values that will be looked for in the DESCRIPTION field of the ical content of an external calendar. When found, HBook will show the value of this field in the column "Comments" for the reservation.

Example with dummy data “Vehicle-Registration” and “Special-Request”.

```
function my_platforms_comment_data ( $default_comment_data ) {
    $additional_data = array(
      'Vehicle-Registration',
      'Special-Request'
    );
    $updated_comment_data = array_merge( $default_comment_data, $additional_data );
    return $updated_comment_data;
}
add_filter( 'hb_ical_additional_info', 'my_platforms_comment_data' );
```

* * *

<a id="hb_ical_additional_non_standard_properties"></a>

#### hb\_ical\_additional\_non\_standard\_properties

**Parameter:**

- **$other\_ical\_non\_standard\_properties:** *(array)* an array of properties that will be looked for in the ical content of an external calendar. When found, HBook will show the value of this field in the column "Comments" for the reservation.

Example with dummy data “X-EXTRAS” and “X-TOTAL-AMOUNT”.

```
function my_platforms_non_standard_properties ( $other_ical_non_standard_properties ) {
    $additional_properties = array(
      'X-EXTRAS',
      'X-TOTAL-AMOUNT'
    );
    $updated_other_non_standard_properties = array_merge( $other_ical_non_standard_properties, $additional_properties );
    return $updated_other_non_standard_properties;
}
add_filter( 'hb_ical_additional_non_standard_properties', 'my_platforms_non_standard_properties' );
```

* * *

<a id="hb_ical_nb_years_history"></a>

#### hb\_ical\_nb\_years\_history

If you are using the query parameter “future\_only” to include past reservations/blocked dates in the iCal export, you may wish to modify the number of years included in the export. By default, HBook includes 2 years of history, when the parameter “future\_only” is passed with “no” as value (to override default value of including only future reservations and blocked dates).

```
function custom_ical_nb_years_history ( $default_delay ) {
    return '6';
}
add_filter( 'hb_ical_nb_years_history', 'custom_ical_nb_years_history' );
```

* * *

<a id="hb_language_list"></a>

#### hb\_language\_list

This filter is applied to the list of languages managed by HBook in a multi-language website.

**Parameter:**

- **$langs:** *(array)* a key *(string)* => value *(string)* array that contains information about the different languages (key is the language locale, value is the language name).

**Example:**  
If you are using a multi-language plugin that is not Polylang or WPML and for which the languages are not detected automatically by HBook:

```
function new_language_list( $langs ) {
	$added_languages = array(
			'fr_FR' => 'French',
			'it_IT' => 'Italian',
			'es_ES' => 'Spanish',
			'de_DE' => 'German'
	);
	$langs = array_merge( $added_languages, $langs );
	return $langs;
}
add_filter( 'hb_language_list', 'new_language_list' );
```

* * *

<a id="hb_uncompleted_resa_deletion_delay"></a>

#### hb\_uncompleted\_resa\_deletion\_delay

- **Expect a returned value as:** *(integer + "MINUTE" or "HOUR")* the delay before HBook delete a reservation that was not completed and is shown as "Processing" status (the customer closed the tab, left the payment process, etc.). By default, HBook delete these uncompleted resrevation after 1 hour.

**Example:**  
Deleting uncompleted reservations after 30 MINUTE.

```
function custom_uncompleted_resa_deletion_delay( $default_delay ) {
	return '30 MINUTE';
}
add_filter( 'hb_uncompleted_resa_deletion_delay', 'custom_uncompleted_resa_deletion_delay' );
```

* * *

<a id="hb_old_resa_logs_deletion_delay"></a>

#### hb\_old\_resa\_logs\_deletion\_delay

- **Expect a returned value as:** *(integer + "DAY" or "MONTH")* the delay of log retention for HBook reservation status changes. These logs are used by ourselves or webdevelopers for debug purposes. By default, HBook delete these logs after 14 days.

**Example:**  
Retaining logs for 28 DAY.

```
function custom_resa_logs_deletion_delay( $default_delay ) {
	return '28 DAY';
}
add_filter( 'hb_old_resa_logs_deletion_delay', 'custom_resa_logs_deletion_delay' );

```

* * *

<a id="hb_retina_scale_factor"></a>

#### hb\_retina\_scale\_factor

**Parameter:**

- **$retina\_scale\_factor:** *(integer)* the scale factor applied to images displayed by HBook (by default the scale factor is 1).

**Example:**  
Displaying images ready for 3x retina devices.

```
function custom_retina_scale_factor( $retina_scale_factor ) {
	return 3;
}
add_filter( 'hb_retina_scale_factor', 'custom_retina_scale_factor' );
```

* * *

<a id="hb_image_sizes"></a>

#### hb\_image\_sizes

**Parameter:**

- **$sizes:** *(multidimensional array)* an array of sizes, each size containing "width" and "height" keys. This filter can be useful if you set that HBook uses "static" images resizing in **HBook > Misc > Misc**. When settings to "Static", HBook don't use AquaResizer.

* * *

<a id="hb_strings"></a>

#### hb\_strings

You can use this filter to add external strings for translation in HBook > Text. It expects in return an array with the **title** of the sections and the **strings** for this new section.

**Example:**

```
function add_my_custom_section_strings() {
  return array(
    'title' => esc_html__( 'My custom section', 'hbook-admin' ),
    'strings' => array(
      'custom_section_text_1' => esc_html__( 'Label for my first text', 'hbook-admin' ),
      'custom_section_text_2' => esc_html__( 'Label for my second text', 'hbook-admin' ),
      'custom_section_text_3' => esc_html__( 'Label for my third text', 'hbook-admin' ),
    )
  );
}
add_filter( 'hb_strings', 'add_my_custom_section_strings' );
```

* * *

<a id="javascript-functions"></a>

## JavaScript functions

<a id="hbook_show_accom_list"></a>

#### hbook\_show\_accom\_list

HBook plugin tries to call this function whenever the list of available accommodation is shown.

**Example:**  
Launching a JavaScript function after the list of available accommodation has been shown.

In the functions.php of your child theme add:

```
add_action( 'wp_enqueue_scripts', 'enqueue_my_js_scripts' );

function enqueue_my_js_scripts() {
	wp_enqueue_script( 'my-script', get_stylesheet_directory_uri() . '/my-script.js', array(), null, true );
}
```

and in the child theme directory create a my-script.js file that contains:

```
function hbook_show_accom_list() {
	my_js_function();
}
```

* * *

<a id="hbook_reservation_done"></a>

#### hbook\_reservation\_done

HBook plugin tries to call this function whenever a reservation is successfully completed by a customer.

**Example:**  
Launching a JavaScript function after a reservation has been made. This can be used if you have conversion or tracking code for example.

In the functions.php of your child theme add:

```
add_action( 'wp_enqueue_scripts', 'enqueue_my_js_scripts' );

function enqueue_my_js_scripts() {
	wp_enqueue_script( 'my-script', get_stylesheet_directory_uri() . '/my-script.js', array(), null, true );
}
```

and in the child theme directory create a my-script.js file that contains:

```
function hbook_reservation_done() {
	my_js_function();
}
```

You will replace “my\_js\_function()” with your code.

HBook reservation information is available when this function is called. Here is an example to retrieve the deposit price and the reservation price:

```
function hbook_reservation_done() {
    var hbSummary = document.getElementsByClassName("hb-payment-data-summary");
    console.log( hbSummary );
    var hbTotal = hbSummary[0].getAttribute("data-charged-total-price-raw");
    console.log( hbTotal );
    var hbDeposit = hbSummary[0].getAttribute("data-charged-deposit-raw");
    console.log( hbDeposit );
}
```