HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/zwafgyp/dodolodge-net/wp-content/themes/hotel-wp/inc/widgets/our-gallery/tpl/default.php
<?php
/**
 * Template for displaying default element.
 *
 *
 * @author      ThimPress
 * @package     Thim_Builder/Templates
 * @version     1.0.0
 * @author      Thimpress, tuanta
 */

$title     = $instance['title'];
$sub_title = !empty($instance['sub-title']) ? $instance['sub-title'] : '';

$limit = !empty($instance['limit']) ? $instance['limit'] : '';

$items = !empty($instance['item-visible']) ? $instance['item-visible'] : 3;

$image_size = !empty($instance['image-size']) ? $instance['image-size'] : '';

$nav  = !empty( $instance['show-navigation'] ) ? 'true' : 'false';
$dots = !empty( $instance['show-dots'] ) ? 'true' : 'false';


$auto = !empty($instance['auto']) ? $instance['auto'] : '0';

if ( $instance['item-visible'] > $instance['limit'] ) {
	$instance['item-visible'] = $instance['limit'];
}

$show_post_gallery = array(
	'post_type'      => 'post',
	'posts_per_page' => $instance['limit'],
	'tax_query'      => array(
		array(
			'taxonomy' => 'post_format',
			'field'    => 'slug',
			'terms'    => array(
				'post-format-gallery'
			),
		)
	)
);


$query = new WP_Query( $show_post_gallery );

if ( $instance['item-visible'] > $instance['limit'] ) {
	$instance['item-visible'] = $instance['limit'];
}
if ( ! empty( $title ) ) {
	?>
	<div class="thim-our-gallery-heading">
		<div class="thim-sc-heading">
			<div class="article_heading">
				<h3 class="title"><?php echo $title; ?></h3>
				<?php
				if ( ! empty( $sub_title ) ) {
					?>
					<div class="heading-des"><?php echo $sub_title; ?></div>
					<?php
				}
				?>
			</div>
		</div>
	</div>
	<?php
}

$available_imgae_sizes = get_intermediate_image_sizes();
preg_match_all( '!\d+!', $image_size, $result );

 if ( in_array( $image_size, $available_imgae_sizes ) ) {
	?>
	<div class="thim-our-gallery owl-carousel owl-theme" data-visible="<?php echo esc_attr( $items ); ?>"
	     data-nav="<?php echo esc_attr( $nav ); ?>" data-dots="<?php echo esc_attr( $dots ); ?>"
	     data-auto="<?php echo esc_attr( $auto ); ?>">
		<?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>

			<?php
			$images = thim_meta( 'thim_gallery', "type=image&single=false&size=thumbnail" );
			$photos = sizeof( $images );

			$src = get_the_post_thumbnail_url( get_the_ID(), $image_size );

			?>

			<div class="item">
				<a class="image" href="<?php echo esc_attr( get_permalink() ); ?>"
				   data-post="<?php echo esc_attr( get_the_ID() ); ?>" data-count="<?php echo esc_attr( $photos ); ?>">
					<img src="<?php echo esc_attr( $src ); ?>">
				</a>
				<div class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
				<div class="count">
					<?php

					if ( $photos <= 1 ) {
						echo $photos . ' ' . esc_html__( ' photo', 'hotel-wp' );
					} else {
						echo $photos . ' ' . esc_html__( ' photos', 'hotel-wp' );
					}
					?>
				</div>
			</div>

		<?php endwhile;
			wp_reset_postdata();
		endif; ?>
	</div>
	<?php
} else {
	?>
	<div class="thim-our-gallery owl-carousel owl-theme" data-visible="<?php echo esc_attr( $items ); ?>"
	     data-nav="<?php echo esc_attr( $nav ); ?>" data-dots="<?php echo esc_attr( $dots ); ?>"
	     data-auto="<?php echo esc_attr( $auto ); ?>">
		<?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>

			<?php
			$images = thim_meta( 'thim_gallery', "type=image&single=false&size=thumbnail" );
			$photos = sizeof( $images );
			if(isset($result[0]) && !empty($result[0])){
				$src = wp_get_attachment_image_url(get_post_thumbnail_id( get_the_ID() ),[$result[0][0],$result[0][1]]);
 			}else{
				$src = wp_get_attachment_image_url(get_post_thumbnail_id( get_the_ID() ),'full');
			}
			?>

			<div class="item">
				<a class="image" href="<?php echo esc_attr( get_permalink() ); ?>"
				   data-post="<?php echo esc_attr( get_the_ID() ); ?>" data-count="<?php echo esc_attr( $photos ); ?>">
					<img src="<?php echo esc_url( $src ); ?>">
				</a>
				<div class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
				<div class="count">
					<?php

					if ( $photos <= 1 ) {
						echo $photos . ' ' . esc_html__( ' photo', 'hotel-wp' );
					} else {
						echo $photos . ' ' . esc_html__( ' photos', 'hotel-wp' );
					}
					?>
				</div>
			</div>

		<?php endwhile;
			wp_reset_postdata();
		endif; ?>
	</div>
	<?php
}