WP Travel Engine
Documentations
WP Travel Engine – Developer Documentation
WP Travel Engine – Developer documentation is a complete guide for theme and plugin developers willing to develop themes or willing to customize and modify functionalities or templates provided by WP Travel Engine plugin. The developer documentation handbook will be a guideline for developing custom travel themes powered by WP Travel Engine.
WP Travel Engine template files contain the markup and template structure for single-trip, archives, and HTML emails of your travel website.
When you open these files, you will notice they all contain hooks that allow you to add/move content without needing to edit template files themselves. This method protects against upgrade issues, as the template files can be left completely untouched.
Template files can be found within the /wp-travel-engine/includes/templates/ directory.
Single Trip Template Files
/wp-travel-engine/includes/templates/single-trip.php /wp-travel-engine/includes/templates/content-single-trip.php /wp-travel-engine/includes/templates/single-trip/trip-content-wrapper-start.php /wp-travel-engine/includes/templates/single-trip/trip-content.php /wp-travel-engine/includes/templates/single-trip/title.php /wp-travel-engine/includes/templates/single-trip/gallery.php /wp-travel-engine/includes/templates/single-trip/tabs-nav.php /wp-travel-engine/includes/templates/single-trip/tabs-content.php /wp-travel-engine/includes/templates/single-trip/trip-content-wrapper-end.php /wp-travel-engine/includes/templates/single-trip/trip-footer.php /wp-travel-engine/includes/templates/single-trip/trip-sidebar.php
Single Trip Tabs
/wp-travel-engine/includes/templates/single-trip/trip-tabs/overview.php /wp-travel-engine/includes/templates/single-trip/trip-tabs/itinerary-tab.php /wp-travel-engine/includes/templates/single-trip/trip-tabs/cost.php /wp-travel-engine/includes/templates/single-trip/trip-tabs/map.php /wp-travel-engine/includes/templates/single-trip/trip-tabs/faqs.php
Archive Template Files
/wp-travel-engine/includes/templates/archive-trip.php /wp-travel-engine/includes/templates/taxonomy-activities.php /wp-travel-engine/includes/templates/taxonomy-destination.php /wp-travel-engine/includes/templates/taxonomy-trip_types.php
Archive Template Layouts
/wp-travel-engine/includes/templates/content-grid.php /wp-travel-engine/includes/templates/content-list.php /wp-travel-engine/includes/templates/widgets/content-widget-feat-trip.php
Page Templates
/wp-travel-engine/includes/templates/template-activities.php /wp-travel-engine/includes/templates/template-destination.php /wp-travel-engine/includes/templates/template-trip_types.php /wp-travel-engine/includes/templates/template-trip-listing.php
Email Templates
/wp-travel-engine/includes/templates/emails/customer-lost-password.php /wp-travel-engine/includes/templates/emails/customer-new-account.php /wp-travel-engine/includes/templates/emails/email-header.php /wp-travel-engine/includes/templates/emails/email-footer.php
Edit files in an upgrade-safe way using overrides. Copy the template into a directory within your theme named /wp-travel-engine keeping the same file structure but removing the /templates/ subdirectory.
Example: To override the Title on Single Trip, copy: wp-content/plugins/wp-travel-engine/includes/templates/single-trip/title.php to wp-content/themes/yourtheme/wp-travel-engine/single-trip/title.php
The copied file will now override the WP Travel Engine default template file.
Warning: Do not edit these files within the core plugin itself as they are overwritten during the upgrade process and any customizations will be lost.
All of the action hooks available in the WP Travel Engine are listed below with hook name, location, and example usage.
Fires before the single trip page content blocks are rendered.
Location: includes/templates/content-single-trip.php
do_action( 'wte_before_single_trip' );
Fires after the single trip page content blocks are rendered.
do_action( 'wte_after_single_trip' );
Fires before the single trip page content blocks are rendered (wrapper).
/** * wp_travel_engine_before_trip_content hook. * * @hooked trip_content_wrapper_start - 5 (outputs opening divs for the trip content) */ do_action( 'wp_travel_engine_before_trip_content' );
Fires after the single trip page content blocks are rendered (wrapper).
/** * wp_travel_engine_after_trip_content hook. * * @hooked trip_content_wrapper_end - 5 (outputs closing divs for the trip content) */ do_action( 'wp_travel_engine_after_trip_content' );
Fires before the tabs on trip single page.
Location: includes/templates/single-trip/tabs-nav.php
do_action('wp_travel_engine_before_trip_tabs');
Fires after the tabs on trip single page.
do_action('wp_travel_engine_after_trip_tabs');
Dynamic Hooks
Dynamic hook that fires before the trip tab content. $field variable to be replaced by the tab key.
/** * @hook - wte_single_before_trip_tab_{field_name} * Dynamic hooks before Tab wrapper - for themes to hook content into. */ do_action( "wte_single_before_trip_tab_{$field}" );
Dynamic hook that fires after the trip tab content. $field variable to be replaced by the tab key.
/** * @hook - wte_single_after_trip_tab_{field_name} * Dynamic hooks after Tab wrapper - for themes to hook content into. */ do_action( "wte_single_after_trip_tab_{$field}" );
Fires before the secondary widget area div in the trip single page.
Location: public/class-wp-travel-engine-template-hooks.php
do_action('wp_travel_engine_before_secondary');
Fires before the pricing section and calendar for dates selection on the trip single page.
do_action('wp_travel_engine_before_trip_price');
Fires after the pricing section and calendar for dates selection on the trip single page.
do_action('wp_travel_engine_after_trip_price');
Fires before the “trips info” section in the sidebar on the trip single page.
do_action('wp_travel_engine_before_trip_facts');
Fires after the “trips info” section in the sidebar on the trip single page.
do_action('wp_travel_engine_after_trip_facts');
Hook to add section/block before the related trips section on the trip single page.
do_action('wp_travel_engine_before_related_posts');
Hook to add section/block after the related trips section on the trip single page.
do_action('wp_travel_engine_after_related_posts');
Fires after the traveler numbers input field in the booking form on the single trip page.
do_action('wpte_after_travellers_input');
Besides all of the available template hooks for a trip single page developers can also unhook any added sections/actions as per their requirements. This can be beneficial in a situation that requires modification of HTML structures and swapping actions priorities to customize the trip single page.
Applies to: class WP_Travel_Engine_Template_Hooks();
Methods: init_hook(); & init_single_trip_hooks();
Example: Removing gallery slider from trip single page.
/** * Removing Gallery Slider from Trip Content * * @package Wp_Travel_Engine */ $single_trip_hooks = WP_Travel_Engine_Template_Hooks::get_instance(); remove_action( 'wte_single_trip_content', array( $single_trip_hooks, 'display_single_trip_gallery' ), 10 );
Fires before the output of billing form in the checkout page.
<?php do_action('wp_travel_engine_before_billing_form'); ?>
Fires before the billing form submit button on the checkout page.
<?php do_action('wte_booking_before_submit_button'); ?>
Fires after the billing form submit button on the checkout page.
<?php do_action('wte_booking_after_submit_button'); ?>
Mini-cart hooks
wte_bf_after_trip_name
Location: includes/templates/checkout/mini-cart.php
Fires after the trip name in the mini cart of the checkout page.
<?php do_action('wte_bf_after_trip_name'); ?>
Fires before saving the billing details are saved in thank you page.
<?php do_action('wp_travel_engine_before_traveller_information_save'); ?>
Fires after saving the billing details are saved in thank you page.
<?php do_action('wp_travel_engine_after_traveller_information_save'); ?>
Fires on the trip archive page that contains the outer wrapper div of the trip archive.
<?php /** * wp_travel_engine_trip_archive_outer_wrapper hook. * * @hooked wp_travel_engine_trip_archive_outer_wrapper - 10 (main wrapper) */ do_action('wp_travel_engine_trip_archive_outer_wrapper'); ?>
Action hook that contains the trip archive loop start.
<?php /** * wp_travel_engine_trip_archive_loop_start hook. * * @hooked wp_travel_engine_trip_archive_loop_start - 10 (loop starts) */ do_action('wp_travel_engine_trip_archive_loop_start'); ?>
Action hook that contains the trip archive loop end.
<?php /** * wp_travel_engine_trip_archive_loop_end hook. * * @hooked wp_travel_engine_trip_archive_end_start - 10 (loop ends) */ do_action('wp_travel_engine_trip_archive_loop_end'); ?>
Filter hooks are available in the WP Travel Engine that lets you filter the output of certainly function or variable based on the filter hook’s location. The major template filter hooks are listed below under the titles of pages they apply to.
Location: includes/class-wp-travel-engine-archive-hooks.php
Filters the archive page search bar sorting options on the trip archive page.
Example
/** * Remove the Name in Ascending option from sorting options. * * @param array $options * @return array $options */ function wpte_dev_doc_filter_archive_sorting_opts( $options) { if ( isset($options['name']) ) { unset($options['name']); } return $options; } add_filter( 'wp_travel_engine_archive_header_sorting_options', 'wpte_dev_doc_filter_archive_sorting_opts' );
Filters the display of page header in the archive block.
add_filter( 'wte_trip_archive_description_page_header', '__return_false' );
Remove the page header section on the trips archive page.
Filters the size of the banner in archive pages. Accepts WordPress default image sizes and images registered form add_image_size().
Example:
/** * Change image size to large **/ add_filter('wp_travel_engine_template_banner_size', function( $size ){ return 'large'; });
Controls the display of archive description in the taxonomy archive pages, Defaults to true.
add_filter( 'wte_trip_archive_description_below_title', '__return_false' );
Filters the trip main price of the trips. Accepts price and trip id is arguments.
Location: includes/wp-travel-engine-helpers.php
Filters the fields of the Enquiry form on Trip single page. When adding a new field with this hook, proper array structure should be maintained for the supported field type.
/** * Remove enquiry form field */ add_filter( 'wp_travel_engine_enquiry_fields_display', function( $enquiry_fields ) { unset( $enquiry_fields['some_key'] ); return $enquiry_fields; } );
Controls the display of the tab titles inside the Trip single page tabs.
add_filter( 'wpte_show_tab_titles_inside_tabs', '__return_false' );
Filters the display of the header steps in the checkout page. Returns a boolean value.
/** * Removes the Progress Checkout Workflow from the content */ add_filter( 'wp_travel_engine_show_checkout_header_steps', '__return_false' );
Filters the array of checkout booking form fields. Takes array of structured values of supported field types.
Location: includes/backend/booking/booking-parts/customer-details.php
/** * Remove Checkout form field */ add_filter( 'wp_travel_engine_booking_fields_display', function( $booking_fields ) { unset( $booking_fields['some_key'] ); return $booking_fields; } );
Gives the __FILE__ path of the main plugin file.
define( 'WP_TRAVEL_ENGINE_FILE_PATH', __FILE__ );
define( 'WP_TRAVEL_ENGINE_BASE_PATH', dirname( __FILE__ ) );
Gives the path of the templates directory of all of the templates used by the WP Travel Engine. The path is /templates in the plugin directory.
define( 'WP_TRAVEL_ENGINE_TEMPLATE_PATH', WP_TRAVEL_ENGINE_BASE_PATH.'/includes/templates' );
Gives the file URL of the plugin directory.
define( 'WP_TRAVEL_ENGINE_FILE_URL', plugins_url( '', __FILE__ ) );
The main version constant of the WP Travel Engine. Returns the current version number of WP Travel Engine plugin.
define( 'WP_TRAVEL_ENGINE_VERSION', 'version_number' );
Your email address will not be published. Required fields are marked *
Comment
Name*
Email*
Website
Save my name, email, and website in this browser for the next time I comment.