Home › Forums › Front-end Issues › Some help to search form
Hi everyone, please I need some help with a search form to a real-state website.
I created 3 advanced custom fields to an specify post type. Type, Type2 and Street.
‘Type’ and ‘Type 2’ are Select values. And ‘Street’ is an input value.
So, I need to show the result page with a loop for this 3 conditions, can you understand to me?
I tried something like this:
$posts = array(
'numberposts' => -1,
'post_type' => 'propiedades',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'tipo_de_propiedad',
'value' => $tipo,
'compare' => '='
),
array(
'relation' => 'AND',
array(
'key' => 'tipo_de_operacion',
'value' => $operacion,
'compare' => '='
),
array(
'key' => 'zona',
'value' => $busqueda,
'compare' => 'LIKE'
),
) //cierra OR
),
);
But no expected results
SOLVED:
$args = array(
‘showposts’ => 10,
‘post_type’ => ‘propiedades’,
‘meta_query’ => array(
‘relation’ => ‘AND’,
array(
‘key’ => ‘tipo_de_propiedad’,
‘compare’ => ‘LIKE’,
‘value’ => $tipo,
),
array(
‘key’ => ‘tipo_de_operacion’,
‘compare’ => ‘LIKE’,
‘value’ => $operacion,
),
array(
‘key’ => ‘zona’,
‘compare’ => ‘LIKE’,
‘value’ => $busqueda,
)
)
);
The topic ‘Some help to search form’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.