<?php

/**
 * Template part for displaying grid posts
 *
 * This template can be overridden by copying it to yourtheme/wp-travel-engine/content-grid.php.
 *
 * @package Wp_Travel_Engine
 * @subpackage Wp_Travel_Engine/includes/templates
 * @since @release-version //TODO: change after travel muni is live
 */
use WpTravelEngine\Modules\TripSearch;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
global $post;
$is_featured              = wte_is_trip_featured( $post->ID );
$settings                 = wptravelengine_settings()->get();
$new_trip_listing         = isset( $settings['display_new_trip_listing'] ) && $settings['display_new_trip_listing'] == 'yes';
$set_duration_type        = isset( $settings['set_duration_type'] ) && ! empty( $settings['set_duration_type'] ) ? $settings['set_duration_type'] : 'days';
$wp_travel_engine_setting = get_post_meta( $post->ID, 'wp_travel_engine_setting', true );
$wpte_trip_images         = get_post_meta( $post->ID, 'wpte_gallery_id', true );

if ( ! isset( $user_wishlists ) ) {
	TripSearch::enqueue_assets();
	$args['user_wishlists'] = wptravelengine_user_wishlists();
	wptravelengine_set_template_args( $args );
}

$view_mode = 'grid';

$classes = 'category-trips-single wpte_new-layout';

if ( $is_featured ) {
	$classes .= ' __featured-trip';
}
?>
<div data-thumbnail="default" class="<?php echo esc_attr( $classes ); ?>" style="--span: 20;" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
	<div class="category-trips-single-inner-wrap">
		<?php
			do_action( 'wptravelengine_before_trip_archive_card' );

			wptravelengine_get_template( 'trip-card/index.php', compact( 'view_mode' ) );

			do_action( 'wptravelengine_after_trip_archive_card' );
		?>
	</div>
</div>