Hi there,
You need this file >> estatik-plugin/includes/classes/pages/admin/class-properties-archive-page.php
There you will find the function – filter_query
Using the filter below you can modify wp query and add your field.
es_admin_properties_meta_query
Hi thanks for the reply.
I’m not able to make it work, i pasted below the code.
if ( ! empty( $_GET['entities_filter'] ) ) {
$filter = $_GET['entities_filter'];
foreach ( array( 'es_category', 'es_type', 'es_status' ) as $taxonomy ) {
if ( ! empty( $filter[ $taxonomy ] ) ) {
$tax_query[] = array(
'taxonomy' => $taxonomy,
'field' => 'id',
'terms' => $filter[ $taxonomy ],
);
}
}
foreach ( array( 'country', 'state', 'province', 'city' ) as $location_field ) {
if ( ! empty( $filter[ $location_field ] ) ) {
$tax_query['es_location'][] = array( 'taxonomy' => 'es_location', 'field' => 'id', 'terms' => $filter[ $location_field ] );
}
}
if ( ! empty( $filter['date_added'] ) ) {
$value = DateTime::createFromFormat( ests( 'date_format' ), $filter['date_added'] );
$query->set( 'year', $value->format( 'Y' ) );
$query->set( 'day', $value->format( 'd' ) );
$query->set( 'monthnum', $value->format( 'm' ) );
}
if ( ! empty( $filter['price_min'] ) ) {
$meta_query['price_min'] = array(
'value' => $filter['price_min'],
'key' => 'es_property_price',
'type' => 'NUMERIC',
'compare' => '>=',
);
}
if ( ! empty( $filter['price_max'] ) ) {
$meta_query['price_max'] = array(
'key' => 'es_property_price',
'value' => $filter['price_max'],
'type' => 'NUMERIC',
'compare' => '<=',
);
}
if ( ! empty( $filter['s'] ) ) {
$meta_query['keywords'] = array(
'key' => 'es_property_keywords',
'value' => $filter['s'],
'compare' => 'LIKE'
);
}
if ( ! empty( $filter['idimmobile'] ) ) {
$meta_query['idimmobile'] = array(
'key' => 'id_immobile',
'value' => $filter['idimmobile'],
'compare' => 'LIKE'
);
}
}
if ( ! empty( $tax_query ) ) {
$query->set( 'tax_query', apply_filters( 'es_admin_properties_tax_query', $tax_query, $query ) );
}
if ( ! empty( $meta_query ) ) {
$query->set( 'meta_query', apply_filters( 'es_admin_properties_meta_query', $meta_query, $query ) );
}
return $query;
}
The filter i’m trying to add is the “idimmobile”.
The ID of the listing field i created is “id_immobile”, but i can’t find how to make it works.
To me it seems all right but when i try to search with it, i just receive empty results.
I hope you can help me.
Best regards.
Hi there,
i didn’t receive any answer, can you help me fix this problem?
I have still no success implementing this kind of search in the backend.
Best regards.
$filter['idimmobile']
You must make sure that this variable has your value.
If you need us to make the necessary customization, please contact us through the form and we will try to help you.