-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-hotel.php
115 lines (103 loc) · 4.45 KB
/
single-hotel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/**
* The main single item template file.
*
* @package kadence
*/
namespace Kadence;
get_header();
/**
* Hook for Hero Section
*/
get_template_part( 'template-parts/entry_hero' );
?>
<section class="c-hotel-ditales">
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-12 pe-5">
<div class="c-hotel-ditales-con">
<?php
$hotel_video = get_field('hotel_video');
// Use preg_match to find iframe src.
preg_match('/src="(.+?)"/', $hotel_video, $matches);
$src = $matches[1];
// Add extra parameters to src and replace HTML.
$params = array(
'controls' => 0,
'hd' => 1,
'autohide' => 1
);
$new_src = add_query_arg($params, $src);
$hotel_video = str_replace($src, $new_src, $hotel_video);
// Add extra attributes to iframe HTML.
$attributes = 'frameborder="0"';
$hotel_video = str_replace('></iframe>', ' ' . $attributes . '></iframe>', $hotel_video);
if ( !empty($hotel_video) ): ?>
<div class="cp-hotel-video">
<?php echo $hotel_video; ?>
</div>
<?php endif; ?>
<?php
$features = get_field('hotel_highlights');
if( $features ): ?>
<div class="cp-hotel-feature">
<h2>Features</h2>
<ul>
<?php foreach( $features as $feature ): ?>
<li>
<span>
<img src="<?php echo $feature['value']; ?>" />
</span>
<p><?php echo $feature['label']; ?></p>
</li>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
</ul>
</div>
<?php endif; ?>
<?php
$description = get_the_content();
if ( !empty($description) ): ?>
<div class="cp-hotel-con">
<h2>DETAILS</h2>
<?php the_content(); ?>
</div>
<?php endif; ?>
<?php
$gallery_img = get_field('hotel_gallery');
if( $gallery_img ): ?>
<div class="cp-hotel-gallery">
<h2>Hotel Gallery</h2>
<div class="row">
<?php foreach( $gallery_img as $image ): ?>
<div class="col-md-4">
<div class="cp-hotel-gallery-img">
<a href="<?php echo esc_url($image['url']); ?>" class="c-gallery-list"
data-lightbox="c-gallery-list">
<img src="<?php echo esc_url($image['sizes']['medium_large']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
</a>
</div>
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<div class="col-lg-4 col-md-12">
<div class="c-hotel-enquery-w">
<?php
$enquire_form = get_field('company_enquire_form', 'option');
if ( !empty($enquire_form) ):
echo '<div class="c-hotel-enquery-in">';
echo do_shortcode($enquire_form);
echo '</div>';
endif;
?>
</div>
</div>
</div>
</div>
</section>
<?php get_footer(); ?>