Okay
  Print

Custom Related Properties

Question : Now on a property for sale, shows as related properties, properties for rent

Related Properties default show property same type with current property 

If you want show Related Properties same status you can follow custom code 

go to location file 

+ plugins\iwproperty\includes\class\property.class.php line 469 

http://prntscr.com/oiqbbi

remove old code 

function get_related( $args = array() ) {
        $limit_item_related = iwp_option('limit_item_related');
        $id = $this->get_id();
        $type = $this->get_type();
        $default_args = array(
            'posts_per_page' => $limit_item_related,
            'post_type' => 'iwp_property',
            'post_status' => 'publish',
            'post__not_in' => array($id),
        );
        if($type){
            $default_args['tax_query'] = array(array(
                'taxonomy' => 'iwp_type',
                'field'    => 'term_id',
                'terms'    => $type->term_id
            ));
        }
        $args = wp_parse_args($args, $default_args);
        $properties = new WP_Query( $args );
        return $properties;
    }

add new code 

function get_related( $args = array() ) {
        $limit_item_related = iwp_option('limit_item_related');
        $id = $this->get_id();
        $type = $this->get_type();
        $status = $this->get_status_obj();
        $default_args = array(
            'posts_per_page' => $limit_item_related,
            'post_type' => 'iwp_property',
            'post_status' => 'publish',
            'post__not_in' => array($id),
        );
        if($type){
            $default_args['tax_query'][] = array(array(
                'taxonomy' => 'iwp_type',
                'field'    => 'term_id',
                'terms'    => $type->term_id
            ));
        }
        if($status){
            $default_args['tax_query'][] = array(array(
                'taxonomy' => 'iwp_status',
                'field'    => 'term_id',
                'terms'    => $status->term_id
            ));
        }
        $args = wp_parse_args($args, $default_args);
        $properties = new WP_Query( $args );
        return $properties;
    }