<?php 
$display = get_field('display_options');
$args = array();
if($display == 'categories'){
	$custom_cat = get_field('room_categories'); 
 	$args = array(
               	'post_type' => 'room_post',
				'posts_per_page'  => -1,
                'tax_query' => array(
                    array(
                        'taxonomy' => 'room_categories',
                        'field' => 'ID',
                        'terms' => $custom_cat
                    )
                )
            );
	}
	elseif($display == 'all')
	{
			$args = array(
					'post_type' => 'room_post',
					'posts_per_page'  => -1
				);
	}
?>


<div class="roomsHomeSlider owl-carousel owl-theme">
		 	<?php if($display == "filter"): ?>
				 <?php $posts = get_field('filter', get_queried_object_id()); ?>
	             	  <?php if($posts):?>
		                  <?php foreach($posts as $post):?>
		                        <?php if (!is_numeric($post)):?>
			                           <?php setup_postdata($post);?>
			                           <article class="theBox roomsBox mainBgColor um_in animated">
					                            <div class="boxContent">
					
													<?php if(has_post_thumbnail()): ?>
					                               		<a href="<?php the_permalink(); ?>">
					                               		<?php the_post_thumbnail('blogMasonry'); ?>	
				                               			</a>
					                            	<?php endif; ?>
					                            </div>
					                            <footer>
					                                <div class="roomTitle um_left">
					                                    <a href="<?php the_permalink(); ?>"><h5 class="title titleUp"><?php the_title(); ?></h5></a>
					                                    <h6><?php the_field('price_label'); ?></h6>
					                                </div>
					                                <div class="roomIcons um_right">
					                                    <div class="boxIcons list-unstyled list-inline text-right">
					                                        <a class="iconHolder brandHover text-center um_expand_lightbox" data-postID="<?php echo $post->ID; ?>" href="#"><i class="fa fa-expand"></i></a>
				                                             <?php 
																$redirectClass = 'um_book';
																if(get_field('redirect_to') != "booking"){
																	$redirectClass = '';	
																}
															 ?>
			                                        		<a class="iconHolder brandHover text-center <?php echo $redirectClass; ?>" data-postID="<?php echo $post->ID; ?>" href="<?php the_field('shop_link'); ?>"><i class="fa fa-bookmark-o"></i></a>    
					                                    </div>
					                                </div>
					                            </footer>
					                        </article>
						              <?php endif;?>
		                 		 <?php endforeach;?>                   
							<?php endif;?>
		 	<?php else: ?>
				<?php 
    				$the_Query = new WP_Query($args);
						while ($the_Query->have_posts()):
							$the_Query->the_post();
	        	 ?>
	 					<article class="theBox roomsBox mainBgColor um_in animated">
                            <div class="boxContent">

								<?php if(has_post_thumbnail()): ?>
                               		<a href="<?php the_permalink(); ?>">
                               		<?php the_post_thumbnail('blogMasonry'); ?>	
                           			</a>
                            	<?php endif; ?>
                            </div>
                            <footer>
                                <div class="roomTitle um_left">
                                    <a href="<?php the_permalink(); ?>"><h5 class="title titleUp"><?php the_title(); ?></h5></a>
                                    <h6><?php the_field('price_label'); ?></h6>
                                </div>
                                <div class="roomIcons um_right">
                                    <div class="boxIcons list-unstyled list-inline text-right">
                                        <a class="iconHolder brandHover text-center um_expand_lightbox" data-postID="<?php echo $post->ID; ?>" href="#"><i class="fa fa-expand"></i></a>
                                         <?php 
											$redirectClass = 'um_book';
											if(get_field('redirect_to') != "booking"){
												$redirectClass = '';	
											}
										 ?>
                                		<a class="iconHolder brandHover text-center <?php echo $redirectClass; ?>" data-postID="<?php echo $post->ID; ?>" href="<?php the_field('shop_link'); ?>"><i class="fa fa-bookmark-o"></i></a>
                                    </div>
                                </div>
                            </footer>
                        </article>
	 			<?php endwhile; ?> 
		<?php endif; ?>
</div><!--owl-->