Find Jobs
Hire Freelancers

Create efficient WordPress meta query

£10-40 GBP

Terminado
Publicado hace más de 8 años

£10-40 GBP

Pagado a la entrega
I'm working with WordPress with custom fields and trying to convert a query which was initially written for pjjtextbase (textfile database) to search a csv file for matching properties for rent/sale. The code works well but is quite inefficient. The code from the original progammer is /***** These values needed for select box *****/ $locations = ptb_listUnique($info, 'Property_Location'); $property_type = ptb_listUnique($info, 'Property_Type'); $property_buy_rent = ptb_listUnique($info, 'Buy_Rent'); //check property $query = Array(); if(!empty($_GET['location'])) { $query[] = "'Property_Location' == '".$_GET['location']."'"; } if(!empty($_GET['type'])) { $query[] = "'Property_Type' == '".$_GET['type']."'"; } if(!empty($_GET['buyrent'])) { $query[] = "'Buy_Rent' == '".$_GET['buyrent']."'"; } //check price if(empty($_GET['buyrent']) || $_GET['buyrent']=="Buy"){ if(!empty($_GET["min_val_buy"]) && is_numeric($_GET["min_val_buy"])){ $min_val_buy = $_GET["min_val_buy"]; } if(!empty($_GET["max_val_buy"]) && is_numeric($_GET["max_val_buy"])){ $max_val_buy = $_GET["max_val_buy"]; } $min_val_buy = min($_GET["min_val_buy"], $_GET["max_val_buy"]); $max_val_buy = max($_GET["min_val_buy"], $_GET["max_val_buy"]); $query[] = "'Price_Rent' >= '".$min_val_buy."'"; $query[] = "'Price_Rent' <= '".$max_val_buy."'"; }else{ if(!empty($_GET["min_val_rent"]) && is_numeric($_GET["min_val_rent"])){ $min_val = $_GET["min_val_rent"]; } if(!empty($_GET["max_val_rent"]) && is_numeric($_GET["max_val_rent"])){ $max_val = $_GET["max_val_rent"]; } $min_val_rent = min($_GET["min_val_rent"], $_GET["max_val_rent"]); $max_val_rent = max($_GET["min_val_rent"], $_GET["max_val_rent"]); $query[] = "'Price_Rent' >= '".$min_val_rent."'"; $query[] = "'Price_Rent' <= '".$max_val_rent."'"; } //check bedrooms if(!empty($_GET["room_no_min"]) && is_numeric($_GET["room_no_min"])){ $room_min_val = $_GET["room_no_min"]; } if(!empty($_GET["room_no_max"]) && is_numeric($_GET["room_no_max"])){ $room_max_val = $_GET["room_no_max"]; } $room_min_val = min($_GET["room_no_min"], $_GET["room_no_max"]); $room_max_val = max($_GET["room_no_min"], $_GET["room_no_max"]); $query[] = "'No_Bedrooms' >= '".$room_min_val."'"; $query[] = "'No_Bedrooms' <= '".$room_max_val."'"; //Now build the query to search $query = implode(' AND ', $query); I would like this to be converted into a WordPress meta array that fits into this code function propertysearch () { $location = preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['location']); $type = preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['type']); $buyrent = preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['buyrent']); $min_val =preg_replace('/[^0-9]/', '', $_GET['min_val']); $room_no_min = preg_replace('/[^0-9]/', '', $_GET['room_no_min']); // This replaces characters in the input string if need be for security reasons META QUERY GOES HERE AND RESULTS = $RESULTS. if(($results == 0) || ($results == false) || ($results == NULL)) : echo '<p>Sorry, there seems to be no results for your request.</p>'; $results = NULL; return $results; else : return $results; endif; } // End of my search
ID del proyecto: 9133750

Información sobre el proyecto

12 propuestas
Proyecto remoto
Activo hace 8 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
Adjudicado a:
Avatar del usuario
Hi ) We are ready to discuss your project. Not the time-wasters ) Please, let us know the details of your project if you will be interested in us! Thank you, Alscon team )
£40 GBP en 1 día
5,0 (73 comentarios)
6,9
6,9
12 freelancers están ofertando un promedio de £38 GBP por este trabajo
Avatar del usuario
I am willing to work with you I am not saying that i am the best but my coding skills show you that i em the best i am highly interested in this job. Skills: Laravel 5 PHP/MYSQL Word Press Code Igniter JS/Jquery HTML/CSS Waiting for your response. Thanks Regards : Muhammad Jawad
£105 GBP en 1 día
4,9 (224 comentarios)
7,5
7,5
Avatar del usuario
Предложение еще не подано
£32 GBP en 1 día
4,9 (444 comentarios)
7,7
7,7
Avatar del usuario
I can do it for you, I've experience 5 years with wordpress , new + custom PLG , themes and more... Now, I believe I can do it good for you! Would happy if work with you !
£37 GBP en 1 día
4,9 (74 comentarios)
6,6
6,6
Avatar del usuario
We have solution for you and we can link these query in WordPress using get_post_meta()function we need to write function for this. Let us have words on this.
£33 GBP en 2 días
0,0 (1 comentario)
0,0
0,0

Sobre este cliente

Bandera de UNITED KINGDOM
London, United Kingdom
5,0
31
Forma de pago verificada
Miembro desde sept 3, 2012

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.