<?php
/**
 * Loop single image
 *
 * This template can be overridden by copying it to yourtheme/wp-real-estate/loop/image.php.
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

$image 	= wre_get_first_image();
$status = wre_get_status();
?>

<div class="image">
	<?php do_action('wre_before_listings_loop_image'); ?>
	<a href="<?php esc_url( the_permalink() ); ?>" title="<?php esc_attr( the_title() ); ?>">

		<?php if( $status ) { ?>
				<span style="background:<?php echo esc_attr( $status['bg_color'] ); ?>;color:<?php echo esc_attr( $status['text_color'] ); ?>" class="status <?php echo esc_attr( strtolower( str_replace( ' ', '-', $status['status']) ) ); ?>">
					<?php if( $status['icon'] ) { ?>
							<i class="wre-icon-<?php echo esc_attr( $status['icon'] ); ?>"></i>
					<?php } ?>
					<?php echo esc_html( $status['status'] ); ?>
				</span>
		<?php } ?>

		<img alt="<?php echo esc_attr( $image['alt'] ); ?>" src="<?php echo esc_url( $image['sml'] ); ?>" />
	</a>
</div>