Support

Account

Home Forums Front-end Issues Some help to search form

Helping

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,
    )
    )
    );

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Some help to search form’ is closed to new replies.