View Categories

Filters Associated With Single Itinerary Page

Filter: wp_travel_show_single_page_title #

Description: Hide or display the trip title on the single trip page.

function prefix_wp_travel_show_single_page_title( $show ) {
    return false; // This will hide the page title.
}
add_filter( 'wp_travel_show_single_page_title', 'prefix_wp_travel_show_single_page_title'  );

Filter: wp_travel_currency_symbols #

Description: Add custom currency symbols.

add_filter( 'wp_travel_currency_symbols', function( $currency_symbols ) {
     $currency_symbols['USD'] = "Your Text";
    return $currency_symbols;
} );

How to add a new currency in the currencies list option?

Filter: wp_travel_itinerary_sale_price #

function wp_travel_customize_sale_price_display( $s, $c, $d ) {
    if ( is_front_page() ) {
        return sprintf( esc_html__('From %1s %2s', 'wp-travel' ), $c , $d );
    }
    return $s;
}
add_filter( 'wp_travel_itinerary_sale_price', 'wp_travel_customize_sale_price_display', 99, 3 );

Filter: wp_travel_custom_itinerary_tabs #

Custom itinerary tabs enable/disable. Default is false

function prefix_wp_travel_custom_itinerary_tabs( $boolean ) {
    return false;
    }
add_filter( 'wp_travel_custom_itinerary_tabs', 'prefix_wp_travel_custom_itinerary_tabs' );

Filter: wp_travel_trip_discounts #

Discount implementation.

function prefix_wp_travel_trip_discounts( $discount, $cart_items ) {
    $discount[โ€˜valueโ€™] = 200;
    return $discount;
    }
add_filter( 'wp_travel_trip_discounts', 'prefix_wp_travel_trip_discounts', 12, 2 );

Filter: wp_travel_is_custom_tabs_support_enabled #

Custom tab support enable/disable.

Source

File: /core/helpers/settings.php
Used by: /core/helpers/settings.php, /inc/helpers.php,
                 /inc/admin/views/tabs/tab-contents/settings/tabs-global.php

Example:

function prefix_wp_travel_is_custom_tabs_support_enabled() {
    return false
}
add_filter( 'wp_travel_is_custom_tabs_support_enabled', 'prefix_wp_travel_is_custom_tabs_support_enabled' );

Filter: wp_travel_multiple_currency #

Support for multiple currencies.

function prefix_wp_travel_multiple_currency( $price ) {
    $price = ( $price * 1.6 );
    return $price;
}
add_filter( 'wp_travel_multiple_currency', 'prefix_wp_travel_multiple_currency' );

Filter: wp_travel_trip_zoomlevel #

Google map zoom level.

function prefix_wp_travel_trip_zoomlevel( $zoomlevel, $trip_id ) {
    $zoomlevel = 15;
    return $zoomlevel;
}
add_filter( 'wp_travel_trip_zoomlevel', 'prefix_wp_travel_trip_zoomlevel', 12, 2 );

Filter :wp_travel_trip_data #

Filter to add trip custom data.

Source

File: /core/helpers/trips.php
Used by: /core/helpers/trips.php

Parameters
$trip_data, $trip->ID

Example:

function prefix_wp_travel_trip_data( $trip_data, $trip_id ) {
    $trip_data[โ€˜custom_dataโ€™] = โ€˜Hello Worldโ€™;
    return $trip_data;
}
add_filter( 'wp_travel_trip_data', 'prefix_wp_travel_trip_data', 12, 2 );

Filter: wp_travel_available_pax #

Filter to add trip custom data.

function prefix_wp_travel_trip_data( $trip_data, $trip_id ) {
    $trip_data['custom_data'] = 'Hello World';
    return $trip_data;
}
add_filter( 'wp_travel_trip_data', 'prefix_wp_travel_trip_data', 12, 2 );

Filter: wp_travel_trip_duration #

This filter enables you to modify the HTML output of the Trip Duration before it appears in the frontend trip listing.

function prefix_wp_travel_trip_duration( $content ) {
    $content = โ€˜MODIFY TRIP DURATION HTML HEREโ€™;
    return $content;
}
add_filter( 'wp_travel_trip_duration', 'prefix_wp_travel_trip_duration' );

Filter: wp_travel_itinerary_tabs #

WP Travel single itinerary tabs.

function prefix_wp_travel_itinerary_tabs( $return_tabs ) {

    $return_tabs['custom_tab'] = array(
        'label'    => 'Travel Tips',
        'callback' => 'prefix_wp_travel_custom_tab_content',
        'priority' => 50,
    );

    return $return_tabs;
}
add_filter( 'wp_travel_itinerary_tabs', 'prefix_wp_travel_itinerary_tabs' );

function prefix_wp_travel_custom_tab_content() {
    echo '<p>Add your custom travel tips or any other content here.</p>';
}

Filter: wp_travel_trip_code #

WP Travel trip code.


function prefix_wp_travel_trip_code( $code, $post_id ) {
    return 'TRIP ' . $post_id;
}
add_filter( 'wp_travel_trip_code', 'prefix_wp_travel_trip_code', 12, 2 );

Filter: wp_travel_default_trip_tabs #

WP Travel default trip tabs.

function prefix_wp_travel_default_trip_tabs( $return_tabs ) {
    $return_tabs[โ€˜overviewโ€™][โ€˜labelโ€™] = __( โ€˜This is overview
    tabโ€™, โ€˜wp-travelโ€™);
    return $return_tabs;
}
add_filter( 'wp_travel_default_trip_tabs', 'prefix_wp_travel_default_trip_tabs' );

Filter: wp_travel_fixed_departure_defalut #

Fixed departure enable/disable.

function prefix_wp_travel_fixed_departure_defalut( $fixed_departure) {
    return โ€˜noโ€™;
}
add_filter( 'wp_travel_fixed_departure_defalut', 'prefix_wp_travel_fixed_departure_defalut' );

Filter: wp_travel_itinerary_faq_questions #

WP Travel faq questions for itinerary.

function prefix_wp_travel_itinerary_faq_questions( $questions, $post_id ) {

    // Add a new FAQ question.
    $questions[] = 'What is included in this trip?';

    return $questions;
}
add_filter( 'wp_travel_itinerary_faq_questions', 'prefix_wp_travel_itinerary_faq_questions', 12, 2 );

Filter: wp_travel_itinerary_faq_answers #

function prefix_wp_travel_itinerary_faq_answers( $answers, $post_id ) {

    // Add the corresponding answer.
    $answers[] = 'This trip includes accommodation, transportation, breakfast, a professional guide, and sightseeing as mentioned in the itinerary.';

    return $answers;
}
add_filter( 'wp_travel_itinerary_faq_answers', 'prefix_wp_travel_itinerary_faq_answers', 12, 2 );

Filter: wp_travel_hide_per_person #

WP Travel per person in a single trip page show or hide.

function prefix_wp_travel_hide_per_person() {
    return true;
}
add_filter( 'wp_travel_hide_per_person', 'prefix_wp_travel_hide_per_person' );

Filter: wp_travel_display_currency_symbol #

Filter for display currency symbol.

function prefix_wp_travel_display_currency_symbol( $price ) {
    $currency_symbol = __( โ€˜NPRโ€™, โ€˜wp-travelโ€™ );
    return $currency_symbol;
}
add_filter( 'wp_travel_display_currency_symbol', 'prefix_wp_travel_display_currency_symbol', 12, 2 );

Filter: wp_travel_related_post_title #

WP Travel related trips title.

Source

File: /templates/content-related-posts.php
Used by: /templates/content-related-posts.php

Parameters
Default is โ€˜esc_html__( ‘Related Trips’, ‘wp-travel’ )โ€™.

Example:

function prefix_wp_travel_related_post_title( $max_available, $pax_limit ) {
    return โ€˜esc_html__( 'Here are Related Trips', 'wp-travel' )โ€™;
}
add_filter( 'wp_travel_related_post_title', 'prefix_wp_travel_related_post_title' );

WP Travel related trips column per row.

Source

File: /templates/content-related-posts.php
Used by: /templates/content-related-posts.php

Parameters
Default is 3.

Example:

function prefix_wp_travel_related_itineraries_col_per_row() {
    return 4;
}
add_filter( 'wp_travel_related_itineraries_col_per_row', 'prefix_wp_travel_related_itineraries_col_per_row' );

Filter: wp_travel_placeholder_image_url #

This filter allows you to display your own logo image instead of WP Travel placeholder image in single itinerary page.

Active Since v4.4.2

Example :

function wp_travel_customized_placeholder_url( $url ) {
    return 'http://wp-travel.test/wp-content/uploads/2021/07/company-name.png';
}
add_filter( 'wp_travel_placeholder_image_url', 'wp_travel_customized_placeholder_url' );

Filter: wptravel_enable_itinerary_toogle #

To Add a Trip Itinerary in an Accordion Format?

add_filter( 'wptravel_enable_itinerary_toogle', function(){ 
  return true; 
} );

Filter: wp_travel_single_archive_group_size #

Display minimum size only on the single trip page #

function wp_travel_custom_single_archive_group_size( $group_size, $trip_id ) {
    $min = 0;
    $max = 0;
    foreach(  WP_Travel_Helpers_Trips::get_trip($trip_id )['trip']['pricings'] as $data ){
        if( $min < $data['min_pax'] ){
            $min = $data['min_pax'];
        }
        if( $max < $data['max_pax'] ){
            $max = $data['max_pax'];
        }
    }
    return '<li>
            <div class="travel-info">
                <strong class="title">Group Size</strong>
            </div>
            <div class="travel-info">
                <span class="value"> Minimum ' . $min = $data['min_pax'] . //Minimum Can be renamed 
                '</span>
            </div>
        </li>';
}
add_filter( 'wp_travel_single_archive_group_size', 'wp_travel_custom_single_archive_group_size', 10, 2 );

Display  maximum size only on the single trip page #

function wp_travel_custom_single_archive_group_size( $group_size, $trip_id ) {
    $min = 0;
    $max = 0;
    foreach(  WP_Travel_Helpers_Trips::get_trip($trip_id )['trip']['pricings'] as $data ){
        if( $min < $data['min_pax'] ){
            $min = $data['min_pax'];
        }
        if( $max < $data['max_pax'] ){
            $max = $data['max_pax'];
        }
    }
    return '<li>
            <div class="travel-info">
                <strong class="title">Group Size</strong>
            </div>
            <div class="travel-info">
                <span class="value"> Maximum ' . $max = $data['max_pax'] . //Maximum can be renamed
                '</span>
            </div>
        </li>';
}
add_filter( 'wp_travel_single_archive_group_size', 'wp_travel_custom_single_archive_group_size', 10, 2 );

Filter: wp_travel_custom_trip_booking_count #

To enable the Custom Booking Count Feature

add_filter( 'wp_travel_custom_trip_booking_count', function( $counts ) {
    return [
        27 => 10, // Trip ID 27 โ†’ Display booking count: 10
        13 => 15, // Trip ID 13 โ†’ Display booking count: 15
    ];
} );