<div class="wrapper brown-bg">
	<form method="POST" class="filter-form wrapper-inside cf" action="<?php echo get_post_type_archive_link('listing');?>">
		<i class="fa fa-search left"></i>
		<div class="left rangeSlider">
			<div class="rangeSldier__amount">
				<label><?php _e('Price range:','aletheme'); ?></label>

				<div class="pricebox">
					<input type="text" name="price_down" value="<?php if(isset($_POST['price_down'])){ echo esc_attr($_POST['price_down']); } else { echo '0'; } ?>" class="sliderRange_first">
					<span> - </span>
					<input type="text" name="price_up" value="<?php if(isset($_POST['price_up'])){ echo esc_attr($_POST['price_up']); } else { echo '459000'; } ?>" class="sliderRange_last">
				</div>
			</div>
			<div class="rangeSldier_scale"></div>
		</div>

		<?php
		//Check if exist Listing posts
		$listings_posts = get_posts('post_type=listing');
		?>

		<select class="dropdown" name="brand">
			<option value="brand" selected disabled><?php echo _e('Brand','aletheme'); ?></option>
			<?php
			if($listings_posts) {
				$rooms = get_terms('brand-listing');
				foreach ($rooms as $room) { ?>
					<option value="<?php echo esc_attr($room->term_id); ?>" class="option_search">
						<?php echo esc_attr($room->name); ?>
					</option>
				<?php }
			}?>
		</select>

		<select class="dropdown" name="status">
			<option value="status" selected disabled><?php echo _e('Status','aletheme'); ?></option>
			<?php
			if($listings_posts) {
				$rooms = get_terms('status-listing');
				foreach ($rooms as $room) { ?>
					<option value="<?php echo esc_attr($room->term_id); ?>" class="option_search">
						<?php echo esc_attr($room->name); ?>
					</option>
				<?php }
			}?>
		</select>

		<div class="submit left red-bg white-bg-hover">
			<input type="submit" value="<?php echo _e('Find car','aletheme'); ?>">
		</div>
	</form>
</div>
