Hello I have some problem with one custumizing one plugin, Im not sure is this a question for wordpress help or php , but im thinking that this is more php issue.
I need to implement location from the search to the search results page title of search results. In this case on the pic the location is BANOVO BRDO and thats one of search criteria so i need to display that search criteria on search results page title. only that one criteria that You can select on search widget and when the search is completed and listed I need to display that one main criteria to let wisitor know that they are on the page of search criteria that they selected, I have quickly draw it on screenshot . I cant figure out how to do this its bugging me for two weeks now.
here is code that needs adding part that displays $state after <?php _e(“Search results:”, ‘es-plugin’); in back end that is mk_states and in database table mk_estatik_manager_states
with id column and column state_title.
CODE
<?php $mk_settings = mk_front_settings(); ?>
<?php if (is_search() || isset($_GET['s'])) : ?>
<div class="mk_success"><?php _e("Search results:</h3>", 'es-plugin');
?></div>
<?php endif; ?>
<?php
global $wpdb;
$address = (isset($_GET['address'])) ? sanitize_text_field($_GET['address']) : "";
$key_words = (isset($_GET['key_words'])) ? sanitize_text_field($_GET['key_words']) : "";
$agent= (isset($_GET['agent'])) ? sanitize_text_field($_GET['agent']) : "";
$type= (isset($_GET['type'])) ? sanitize_text_field($_GET['type'][0]) : "";
$category = (isset($_GET['category'])) ? sanitize_text_field($_GET['category'][0]) : "";
$price_min = (isset($_GET['price_min'])) ? sanitize_text_field($_GET['price_min']) : "";
$price_max = (isset($_GET['price_max'])) ? sanitize_text_field($_GET['price_max']) : "";
$bedrooms_min = (isset($_GET['bedrooms_min'])) ? sanitize_text_field($_GET['bedrooms_min']) : "";
$country = (!empty($_GET['country'])) ? $_GET['country'] : array();
$country = sanitize_text_field(implode(',', $country));
$state = (!empty($_GET['state'])) ? $_GET['state'] : array();
$state = sanitize_text_field(implode(',', $state));
$city = (!empty($_GET['city'])) ? $_GET['city'] : array();
$city = sanitize_text_field(implode(',', $city));
$bedrooms_max = (isset($_GET['bedrooms_max'])) ? sanitize_text_field($_GET['bedrooms_max']) : "";
$bathrooms_min = (isset($_GET['bathrooms_min'])) ? sanitize_text_field($_GET['bathrooms_min']) : "";
$bathrooms_max = (isset($_GET['bathrooms_max'])) ? sanitize_text_field($_GET['bathrooms_max']) : "";
$area_min = (isset($_GET['area_min'])) ? sanitize_text_field($_GET['area_min']) : "";
$area_max = (isset($_GET['area_max'])) ? sanitize_text_field($_GET['area_max']) : "";
$lotsize_min = (isset($_GET['lotsize_min'])) ? sanitize_text_field($_GET['lotsize_min']) : "";
$lotsize_max = (isset($_GET['lotsize_max'])) ? sanitize_text_field($_GET['lotsize_max']) : "";
$where = "";
$where_array = array();
if($address != ''){
$where_array[] = 'prop_address like "%'.$address.'%"';
}
if ($country != '') {
$where_array[] = 'country_id IN (' . $country . ')';
}
if ($state != '') {
$where_array[] = 'state_id IN (' . $state . ')';
}
if ($city != '') {
$where_array[] = 'city_id IN (' . $city . ')';
}
if($price_min != '' && $price_max == '' ){
$where_array[] = ' prop_price >= '.$price_min.'';
}
if($price_max != '' && $price_min == '' ){
$where_array[] = ' prop_price <= '.$price_max.'';
}
if($price_min != '' && $price_max != '' ){
$where_array[] = ' prop_price BETWEEN '.$price_min.' AND '.$price_max.'';
}
if($bedrooms_min != '' && $bedrooms_max == '' ){
$where_array[] = ' prop_bedrooms >= '.$bedrooms_min.'';
}
if($bedrooms_max != '' && $bedrooms_min == '' ){
$where_array[] = ' prop_bedrooms <= '.$bedrooms_max.'';
}
if($bedrooms_min != '' && $bedrooms_max != '' ){
$where_array[] = ' prop_bedrooms BETWEEN '.$bedrooms_min.' AND '.$bedrooms_max.'';
}
if($bathrooms_min != '' && $bathrooms_max == '' ){
$where_array[] = ' prop_bathrooms >= '.$bathrooms_min.'';
}
if($bathrooms_max != '' && $bathrooms_min == '' ){
$where_array[] = ' prop_bathrooms <= '.$bathrooms_max.'';
}
if($bathrooms_min != '' && $bathrooms_max != '' ){
$where_array[] = ' prop_bathrooms BETWEEN '.$bathrooms_min.' AND '.$bathrooms_max.'';
}
if($area_min != '' && $area_max == '' ){
$where_array[] = ' prop_area >= '.$area_min.'';
}
if($area_max != '' && $area_min == '' ){
$where_array[] = ' prop_area <= '.$area_max.'';
}
if($area_min != '' && $area_max != '' ){
$where_array[] = ' prop_area BETWEEN '.$area_min.' AND '.$area_max.'';
}
if($lotsize_min != '' && $lotsize_max == '' ){
$where_array[] = ' prop_lotsize >= '.$lotsize_min.'';
}
if($lotsize_max != '' && $lotsize_min == '' ){
$where_array[] = ' prop_lotsize <= '.$lotsize_max.'';
}
if($lotsize_min != '' && $lotsize_max != '' ){
$where_array[] = ' prop_lotsize BETWEEN '.$lotsize_min.' AND '.$lotsize_max.'';
}
if($category != ''){
$where_array[] = 'prop_category = "'.$category.'"';
}
if($type != ''){
$where_array[] = 'prop_type = "'.$type.'"';
}
if($agent != ''){
$where_array[] = 'agent_id = "'.$agent.'"';
}
if(!empty($_GET['agent'])){
$where_array[] = 'agent_id = "'.$_GET['agent'].'"';
}
$keyword_array = array();
$where_keyword ="";
if($key_words != ''){
$keyword_array[] = 'prop_title like "%'.$key_words.'%"';
$keyword_array[] = 'prop_description like "%'.$key_words.'%"';
$keyword_array[] = 'prop_address like "%'.$key_words.'%"';
$keyword_array[] = 'prop_meta_keywords like "%'.$key_words.'%"';
$keyword_array[] = 'prop_meta_description like "%'.$key_words.'%"';
$where_keyword = " AND ( ".implode(" OR ",$keyword_array)." )";
}
$where_array[] = 'prop_pub_unpub = 1';
$where = implode(" AND ",$where_array);
get_list("WHERE ($where) $where_keyword", "ORDER BY prop_area asc", $esLayout);
?>