For developers: hooks and functions

Filters, actions and functions for customizing Travelight in a child theme or plugin.

Travelight is built to be extended without editing its files. Use these hooks from a child theme or a small plugin.

Theme

  • travelight_defaults (filter): default values of every Customizer setting
  • travelight_front_sections (filter): which homepage sections show, and in what order
  • travelight_front_section_{section} (action): replace a homepage section with your own output
  • travelight_testimonials (filter): the testimonials shown on the homepage
  • travelight_tour_price_html and travelight_tour_badge (filters): price and badge on tour cards and pages
  • travelight_enquiry_url (filter): where Enquire buttons go
  • travelight_footer_credit (filter): the footer credit
  • travelight_hero_after_actions, travelight_archive_before_loop, travelight_tour_after_highlights, travelight_tour_after_content and travelight_tour_facts (actions): places to add your own output

Travelight Core

Read tour and destination data with these functions, so your code keeps working if the theme changes:

  • travelight_core_tour_data( $post_id )
  • travelight_core_destination_data( $post_id )
  • travelight_core_featured_query( $post_type, $count )
  • travelight_core_destination_tours( $destination_id, $count )
  • travelight_core_contact_form( $args )

Hooks:

  • travelight_core_fields (filter): add or change tour and destination fields
  • travelight_core_tour_data and travelight_core_destination_data (filters)
  • travelight_core_contact_recipient and travelight_core_contact_rate_limit (filters)
  • travelight_core_save_submission (filter) and travelight_core_form_submitted (action): store or forward form messages
  • travelight_core_demos (filter) and travelight_core_demo_imported (action)

For example, to send form messages to a bookings address:

add_filter( 'travelight_core_contact_recipient', function () {
	return 'bookings@example.com';
} );

Travelight Pro

  • travelight_pro_tour_form_args (filter): options for the tour enquiry form
  • travelight_pro_tour_days (filter): set the number of days used by the length filter

Stored data

Tour and destination fields are saved as post meta named _travelight_{field}, for example _travelight_price. Pro stores _travelight_pro_itinerary, _travelight_pro_departures, _travelight_pro_child_price, _travelight_pro_sale_price and _travelight_pro_badge.