Advance custom post type Checkbox issue

enter image description here

I have a problem with checkbox.I create a filter in my pages.php and i want to displaying all my post which have checked value,or displaying all my post if checkbox is not checked.I would like that when the parking button is pressed, it displays posts that have a parking area,Or if the field is not pressed to show all posts with other parameters..How i can create query for solve this problem?

 $ourCurrentPage = get_query_var('paged');
$args = array(
    'post_type' => 'post',
    'posts_per_page' => 4,
    'order' => 'DESC',
    'paged' => $ourCurrentPage,
    'meta_query' => array(
         array(
             'key' => 'parking',
             'type' => 'TEXT',
             'value' => $parking,
             'compare' => 'LIKE'
         )                   
    )
);

$query = new WP_Query($args);

while ( $query->have_posts() ) : $query->the_post(); ?>

Read more here:: Advance custom post type Checkbox issue

Leave a Reply

Your email address will not be published. Required fields are marked *