* @copyright Copyright (C) 2015 wpopal.com. All Rights Reserved. * @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html * * @website http://www.wpopal.com * @support http://www.wpopal.com/questions/ */ if ( ! defined( 'ABSPATH' ) ) { exit; } $args = [ 'post_type' => 'opalestate_property', 'posts_per_page' => $num, 'post__not_in' => [ get_the_ID() ], ]; $price = get_post_meta( get_the_ID(), OPALESTATE_PROPERTY_PREFIX . 'price', true ); $status = wp_get_post_terms( get_the_ID(), 'opalestate_status' ); $args['meta_query'] = []; $tax_query = []; if ( ! is_wp_error( $status ) && $status ) { $tax_query[] = [ 'taxonomy' => 'opalestate_status', 'field' => 'slug', 'terms' => $status[0]->slug, ]; } if ( $tax_query ) { $args['tax_query'] = [ 'relation' => 'AND' ]; $args['tax_query'] = array_merge( $args['tax_query'], $tax_query ); } $search_min_price = floatval( $price ) - floatval( $range_price ); $search_max_price = floatval( $price ) + floatval( $range_price ); if ( $search_min_price != '' && $search_min_price != '' && is_numeric( $search_min_price ) && is_numeric( $search_max_price ) ) { array_push( $args['meta_query'], [ 'key' => OPALESTATE_PROPERTY_PREFIX . 'price', 'value' => [ $search_min_price, $search_max_price ], 'compare' => 'BETWEEN', 'type' => 'NUMERIC', ] ); } elseif ( $search_min_price != '' && is_numeric( $search_min_price ) ) { array_push( $args['meta_query'], [ 'key' => OPALESTATE_PROPERTY_PREFIX . 'price', 'value' => $search_min_price, 'compare' => '>=', 'type' => 'NUMERIC', ] ); } elseif ( $search_max_price != '' && is_numeric( $search_max_price ) ) { array_push( $args['meta_query'], [ 'key' => OPALESTATE_PROPERTY_PREFIX . 'price', 'value' => $search_max_price, 'compare' => '<=', 'type' => 'NUMERIC', ] ); } $query = Opalestate_Query::get_property_query( $args ); if ( $query->have_posts() ): echo str_replace( 'widget-style', 'widget-style widget-danger', trim( $before_widget ) ); //Our variables from the widget settings. $title = apply_filters( 'widget_title', $title ); if ( $title ) { echo ( $before_title ) . trim( $title ) . $after_title; } ?>
have_posts() ): $query->the_post(); $property = opalesetate_property( get_the_ID() ); $meta = $property->get_meta_shortinfo(); ?>
>
', '' ); ?>
get_price() ); ?> get_sale_price() ): ?> get_sale_price() ); ?> get_price_label() ): ?> get_price_label(); ?>