Support

Account

Home Forums General Issues Can not access the camp select custom

Unread

Can not access the camp select custom

  • I’m intending to access a sub camp of electoral type, which is idioms> idioms and here elige between a list of idioms, between them ‘English’. But when the English bus searcher did not send me any dates

    <?php
    /*
    
    EL PROBLEMA ES QUE NO ES UN VALOR DE TEXTO SINO UN SELECT Y SE GUARDA
    EN LA BASE DE DATOS  COMO MATRIZ SERIALIZADA, SE DEBE MODIFICAL LA META CONSULTA
    
    */
    
    require_once("../wp-load.php");
    switch_to_blog(5);
    echo '
        <form class="form form--search" action="" method="post">
            <fieldset>
                <div>
                    <input type="hidden" name="custom_field" value="field_57c7fadfc5635" />
                    <input type="search" name="s" class="search__input" placeholder="Buscar por organizaciĆ³n" />
                    <button type="submit" class="button button--submit">Submit</button>
                </div>
            </fieldset>
        </form>
    ';
    //AJAX
    $args = array(
        'post_type'              => array( 'profesiones' ),
        'posts_per_page'         => -1,
        'post_status'            => array( 'publish' ),
        'meta_key'				 => 'nombre_profesion',
        'meta_query'             => array(
            array(
                    'relation'	=> 'AND',
                    array(
                        'key'     =>  $_POST['custom_field'],
                        'value'   =>  $_POST['s'],
                        'compare' => 'LIKE'
                    )
                )
        ),
        'orderby'    => 'meta_value',
        'order'	    => 'ASC',
    );
    $query = new WP_Query( $args );
    if ( $query->have_posts() ) : 
        echo '<table border="1">
        <thead>
            <tr>
                <th>Nombre de la profesion</th>
            </tr>
        </thead>
        <tbody>';
        while ( $query->have_posts() ) :
            $query->the_post();
            echo '<tr>
                    <td><a href="'.get_the_permalink().'">'.get_field('plural').'</a></td>
                </tr>';
        endwhile;
        echo '</tbody>
        </table>';
    endif;
    wp_reset_query();
    restore_current_blog();
    ?>
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.