Site icon Hip-Hop Website Design and Development

WP Question from two Customized Submit kind fields as assertion

I’ve two customized submit kind desk and reservation. Additionally on the CPT reservation I made three customized fields date, hour and IDtable (this meta discipline I made to storage ID of the desk, so this IDtable is saving the ID of the desk queries). I wish to examine if is any desk (e.g. I’ve 3 queries like table1, table2, table3) free within the date (e.g. 28.10.2021) on the hour (e.g. 20.00). How I can show this in wordpress, I believe I’ve to make use of left be part of, however I’m caught.

Right here is the customized fields for reservation

$curent_reservation_date_hour = get_post_meta ($post->ID, 'hour', true ); // 
$curent_reservation_date_day = get_post_meta ($post->ID, 'date', true ); // 
$curent_table_id = get_post_meta ($post->ID, 'IDtable', true ); // 

$arg= array(
            'posts_per_page' => -1,
            'post_type' => array(  'desk', 'reservation', ),
            'meta_query' => array(
                'relation' => 'AND',
                array(
                    'key' => 'IDtable',
                    'worth' => $curent_table_id,
                    'evaluate' => 'NOT IN'
                ),
                array(
                    'key' => 'date',
                    'worth' => $curent_reservation_date_day,
                    'evaluate' => 'NOT IN'
                ),
                array(
                    'key' => 'hour',
                    'worth' => $curent_reservation_date_hour,
                    'evaluate' => 'NOT IN'
                ),
                array(
                    'key' => 'id',
                    'worth' => $curent_reservation_date_hour,
                    'evaluate' => 'NOT IN'
                ),
            )
        ); 
$queryTableReserve = new WP_Query( $arg); 
        if ( $queryTableReserve->have_posts() ) { 
            whereas ($queryTableReserve->have_posts()){
                $queryTableReserve->the_post(); 
                //_reservation_date_day
                echo 'Tables availabel ... '.get_the_title().'<br>';
            }//shut whereas
            wp_reset_postdata(); 
        } else {
            echo 'outcomes 0<br>';
        }
        wp_reset_postdata();