-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-listings-original.php
375 lines (268 loc) · 13.1 KB
/
single-listings-original.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<?php
$layout = $ct_options['ct_listing_single_layout'];
$prop_name = get_post_meta( $post->ID, '_ah_prop_name', true );
$prop_city = get_post_meta( $post->ID, '_ah_listing_city', true );
$term_list = wp_get_post_terms($post->ID, 'state', array("fields" => "names"));
$prop_state = $term_list[0];
$prop_form_sc = '[gravityform id="18" name="Property Request a Quote" title="false" description="false" field_values="city='.$prop_city.'&state='.$prop_state.'&internal='.$prop_name.'"]';
get_header(); ?>
<?php if($layout == "left-sidebar" || $layout == "three-column") { ?>
<div id="left-sidebar" class="<?php if($layout == "three-column") { echo 'four'; } else { echo 'five'; } ?> columns alpha">
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Listing Single Left') ) :else: endif; ?>
<div class="clear"></div>
</div>
<?php } ?>
<!-- NOTE: $layout == right-sidbar has been updated to span the width of the container "container-fluid" in order to accomodate responsiveness. -->
<section id="content" class="<?php if($layout == "left-sidebar") { echo 'eleven omega'; } elseif($layout == "right-sidebar") { echo 'container-fluid'; } elseif($layout == "three-column") { echo 'eight'; } elseif($layout == "full-width") { echo 'sixteen alpha omega'; } ?> columns">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$city = get_post_meta( $post->ID, '_ah_listing_city', true );
$features = get_post_meta( $post->ID, '_ah_listing_features', true );
$amenities = get_post_meta( $post->ID, '_ah_listing_amenities', true );
$ah_post_id = get_post_meta( $post->ID, '_ah_post_id', true );
$listing_content = get_post_meta( $post->ID, '_ah_listing_content', true ); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('marB20'); ?>>
<?php if ( !( $title = get_post_meta( $post->ID, '_ah_listing_h1', true ) ) ) $title = get_the_title(); ?>
<h1 class="entry-title marB0"><?php echo $title; ?></h1>
<p class="prop-location"><?php echo $city; ?>, <?php state(); ?> <?php zipcode(); ?></p>
<p class="propinfo"><strong><?php if(has_type('land') || has_type('lot')) { ?><?php echo get_post_meta($post->ID, "_ct_lotsize", true); ?> <?php acres(); ?><?php } elseif(has_type('commercial')) { ?><?php // Display Nothing ?><?php } else { ?><?php beds(); ?> <?php baths(); ?> <?php if((get_post_meta($post->ID, "_ct_sqft", true))) { ?> | <?php echo get_post_meta($post->ID, "_ct_sqft", true); ?> <?php sqftsqm(); ?><?php } ?><?php } ?> <?php if((get_post_meta($post->ID, "_ct_mls", true))) { ?> | <?php _e('MLS', 'contempo'); ?> # <?php echo get_post_meta($post->ID, "_ct_mls", true); ?><?php } ?></strong></p>
<p><?php ahu_tag_line_content(); ?></p>
<?php $attachments = get_children(
array(
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_parent' => $post->ID
)); ?>
<?php if(count($attachments) > 1) { ?>
<div class="row">
<div class="col-md-7">
<div id="slider" class="flexslider marB18">
<?php ct_status(); ?>
<ul class="slides">
<?php ah_slider_images(); ?>
</ul>
</div>
<div id="carousel" class="flexslider">
<ul class="slides">
<?php ah_slider_images_thumb(); ?>
</ul>
</div>
<div class="panel panel-default cust-gradient mb-1618">
<div class="panel-body">
<div class="row-4">
<div class="col-6 flex-middle">
<p class="lead-white text-center">Get A Quote. Let's Plan Your Stay.</p><i class="fas fa-hand-point-right fa-2x"></i>
</div>
<div class="col-6 flex-middle">
<button class="ah-button f-r ah-button-wide" data-toggle="modal" data-target="#exampleModalCenter">Click Here To Request A Quote</button>
</div>
</div>
</div>
</div>
</div> <!-- /.col-md-7 -->
<?php } else {
echo '<div class="single-listing-image">';
// functionality to get first image of the correct size
$args = array(
'numberposts' => 1,
'order' => 'ASC',
'post_mime_type' => 'image',
'post_parent' => get_the_ID(),
'post_status' => null,
'post_type' => 'attachment',
);
$attachments = get_children( $args );
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
// $image_attributes = wp_get_attachment_image_src( $attachment->ID, 'listing-slider' ) ? wp_get_attachment_image_src( $attachment->ID, 'listing-slider' ) : wp_get_attachment_image_src( $attachment->ID, 'full' );
$image_attributes = wp_get_attachment_image_src( $attachment->ID, 'listing-slider' );
echo '<img src="' . $image_attributes[0] . '" class="current">' .
'</div>';
}
}
} ?>
<?php if(count($attachments) > 1) { ?>
<div class="col-md-5">
<?php the_content(); ?>
</div>
</div> <!-- /.row -->
<div class="post-content marT20">
<?php } else { ?>
<div class="clear"></div>
<div class="post-content marT20">
<?php the_content(); ?>
<?php if(get_post_meta($post->ID, "_ct_video", true)) { ?>
<div class="videoplayer">
<?php echo stripslashes(get_post_meta($post->ID, "_ct_video", true)); ?>
</div>
<?php }
} ?>
</div>
</article>
<?php if($ct_options['ct_post_comments'] == "Yes" && comments_open()) { ?>
<?php comments_template( '', true ); ?>
<?php } ?>
<?php endwhile; ?>
<?php //wp_link_pages(); ?>
<?php endif; ?>
</section>
<!-- ****** REQUEST A QUOTE ******* -->
<div id="right-sidebar" class="<?php if($layout == "three-column") { echo 'four'; } else { echo 'container-fluid'; } ?> columns omega">
<div class="clear"></div>
<!-- ****** PROPERTY FEATURES ****** -->
<div class="panel panel-green">
<div class="panel-heading prop-features">
<h4 class="panel-title medium">Property Features</h4>
</div>
<div class="panel-body">
<aside class="listing widget">
<h4 class="medium mt-1618">This Home Offers These Features</h4>
<div id="containerul">
<?php echo $features; ?>
</div>
</aside>
<?php if ( $amenities ) { ?>
<aside class="listing widget">
<h4 class="medium mt-1618">Community Amenities</h4>
<div id="containerul2">
<?php echo $amenities; ?>
</div>
</aside>
<?php } ?>
<div class="panel panel-default cust-gradient-2">
<div class="panel-body">
<div class="row-4">
<div class="col-6 flex-middle">
<button class="ah-button f-r ah-button-wide" data-toggle="modal" data-target="#exampleModalLong">Click To View Housing Package</button>
</div>
<div class="col-6 flex-middle">
<i class="fas fa-hand-point-left fa-2x"></i><p class="lead-white-reverse text-center">We Provide Complete Housing Packages.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-green">
<div class="panel-heading prop-features">
<h4 class="panel-title medium">Client Testimonials</h4>
</div>
<div class="panel-body testimonial-widget">
<?php ah_testimonials(); ?>
</div>
</div>
<div class="post-content marT20 mb-2618">
<div id="location">
<h5 class="medium marB10"><?php _e('Location', 'contempo'); ?></h5>
<div id="map">
<?php ah_listing_map(); ?>
</div>
</div>
<?php if ( $listing_content ) {
echo $listing_content;
} ?>
<?php if ( $ah_post_id ) {
ah_latest_news( $ah_post_id );
} ?>
</div>
<div class="panel panel-green">
<div class="panel-heading prop-features">
<h4 class="panel-title medium">Nearby Properties</h4>
</div>
<div class="panel-body">
<div class="container-fluid">
<div class="row d-flex justify-content-center">
<?php
$terms_as_text = strip_tags( get_the_term_list( $post->ID, 'city', '', ', ', '' ) );
$tags = strtolower( $terms_as_text );
$terms = get_the_terms( $post->ID, 'city');
if ( $terms && ! is_wp_error( $terms ) ) {
$tag_list = array();
foreach( $terms as $term ) {
$tag_list[] = $term->term_id;
}
$the_tags = join( ", ", $tag_list );
}
$current_id = get_the_ID(); // get id of current property, so it doesn't display in this list
// var_dump($tag_list);
$args = array(
'post_type' => 'listings',
'tax_query' => array(
array(
'taxonomy' => 'city',
'field' => 'id',
'terms' => $tag_list,
)
),
'post__not_in' => array( $current_id )
);
$rowCount = 0;
$numOfCols = 4;
// The Query
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
$property_page = 1;
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<div class="col-md-3">' .
'<div class="thumbnail">';
echo '<a href="' . get_permalink() . '">';
ah_first_image_thumb( $the_query->post->ID, $property_page );
echo '</a>';
echo '<div class="caption">';
echo '<p class="text-center card-text"><a href="' . get_permalink() . '">' . get_the_title() . '</a></p>';
echo '</div>' .
'</div>' .
'</div>';
$rowCount++;
if($rowCount % $numOfCols == 0) echo '</div><div class="row d-flex justify-content-center">';
}
} else {
echo 'No other properties are available';
}
/* Restore original Post Data
* NB: Because we are using new WP_Query we aren't stomping on the
* original $wp_query and it does not need to be reset.
*/
wp_reset_postdata(); ?>
</div>
</div>
<div class="panel panel-default cust-gradient mb-1618">
<div class="panel-body">
<div class="row-4">
<div class="col-6 flex-middle">
<p class="lead-white text-center">Get A Quote. Let's Plan Your Stay.</p><i class="fas fa-hand-point-right fa-2x"></i>
</div>
<div class="col-6 flex-middle">
<button class="ah-button f-r ah-button-wide" data-toggle="modal" data-target="#exampleModalCenter">Click Here To Request A Quote</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<img src="<?php bloginfo('stylesheet_directory' ); ?>/images/chpa-logo.png" alt="CHPA">
<p> Almost Home is a proud member of The Corporate Housing Providers Association (CHPA), the association worldwide for the industry of corporate housing. We've been a member since 2003.</p>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<h4>7 Secrets to Finding the Best Corporate Housing</h4>
<p>Receive helpful advice on how to find the best corporate housing that meets your needs.</p>
<form action="https://almosthome.infusionsoft.com/AddForms/processFormSecure.jsp" method="post">
<input value="eedba9b65e06620389783e889da9d2a8" id="infusion_xid" name="infusion_xid" type="hidden">
<input value="CustomFormWeb" id="infusion_type" name="infusion_type" type="hidden">
<input value="AH 7 Secrets Opt-In Form for Homepage" id="infusion_name" name="infusion_name" type="hidden">
<input size="15" name="Contact0FirstName" value="First Name" type="text">
<input size="15" name="Contact0Email" value="Email" type="text">
<?php echo apply_filters( 'cptch_display', '' ); ?>
<input value="Submit" class="button np inf-button" id="Submit" name="Submit" type="submit"></td>
</form>
<small>Your information will be not be sold or distributed.</small>
</div>
</div>
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Listing Single Right') ) :else: endif; ?>
<div class="clear"></div>
</div>
<?php get_footer('listings'); ?>