WP Travel plugin allows you to define minimum (Min Pax) and maximum (Max Pax) passenger limits for trips. This short guide will help you customize the Pax display on your site.

This feature helps manage bookings effectively by setting group size constraints. By default, only the maximum passenger limit (Max Pax) is displayed on the trip listing page to provide a clear view of trip capacity.

Trips showing the maximum number of Pax allowed.

To fully customize the Pax display on the Archive Page, you can use the following code snippets. Depending on your requirements, you can choose to display the Min-Max range, Maximum Pax only, or Minimum Pax only, with customizable labels.

Add the Code to Your Site

You can add the code snippets below to the functions.php file of your child theme or use a plugin like Code Snippets to apply them. For detailed instructions on creating a child theme, refer to the WP Travel Knowledge Base.

1. Display Min-Max Pax on the Archive Page

This snippet displays both the minimum and maximum passenger limits for a trip in the format β€œMin X – Max Y.”

function wp_travel_custom_archives_page_trip_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 'Min ' . $min . ' -  Max ' . $max; //Min and Max can be replaced
}
add_filter( 'wp_travel_archives_page_trip_group_size', 'wp_travel_custom_archives_page_trip_group_size', 10, 2 );
Trips displaying their minimum and maximum pax

2. Display Maximum Pax Only on the Archive Page

This snippet displays the maximum passenger limit with a customizable label, such as β€œMaximum X passengers.”

function wp_travel_custom_archives_page_trip_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   $max . ' maximum';//maximum can be renamed
}
add_filter( 'wp_travel_archives_page_trip_group_size', 'wp_travel_custom_archives_page_trip_group_size', 10, 2 );
Trips only displaying their maximum pax limit

3. Display Minimum Pax Only on the Archive Page

This snippet displays the minimum passenger limit with a customizable label, such as β€œMinimum X passengers.”

function wp_travel_custom_archives_page_trip_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   $min . ' min'; //man can be renamed
}
add_filter( 'wp_travel_archives_page_trip_group_size', 'wp_travel_custom_archives_page_trip_group_size', 10, 2 );
Trips only displaying their minumum pax requirement

Conclusion

Customizing the Pax display on your site not only gives you greater flexibility but also enhances the overall user experience by presenting trip details in a clear and relevant way. Whether you want to show the full Min-Max range, focus on the Maximum Pax, or emphasize the Minimum Pax, these code snippets allow you to tailor the information to your site’s requirements. Simply choose and implement the desired snippet to make your Archive Page more informative and engaging for your customers.

Check WP Travel documentation to learn more about configurations, modules, payments, shortcodes, and the WP Travel Rest API.

Your feedback helps us improve. Please share your thoughts.

Need assistance? Contact our support team, join our Facebook community, and subscribe to our YouTube Channel for video tutorials. Thank you for choosing WP Travel.

Get WP Travel Pro