Do not add empty value

Viewed 22

I need help on my video code. I don't want to add the video that has no value on my post base on acf

function diaphragmatic_breathing_player() {
    $args = array(  
                'post_type' => 'video',
                'post_status' => 'publish',
                'meta_key' => 'diaphragmatic_breathing_page_order',
                'orderby' => 'meta_value',
                'order' => 'ASC'
            );
    $loop = new WP_Query( $args );
?>

I don't want to add the video that has no value on my post base on acf

    <div id="videoPlayer">

        <div class="main_video">
            <?php 
            while ( $loop->have_posts() ) : $loop->the_post();
                    $video_file = get_field('video_file');
                    $url = $video_file['url'];
            ?>
            <div class="main_slide video-placeholder" data-src="<?php echo esc_attr($url); ?>" id="video-<?=get_the_ID();?>">
                <img src="<?php the_post_thumbnail_url(); ?>" width="1000" height="1000" alt="<?= get_the_title();?>"/>
            </div>
            <?php
            endwhile;

            wp_reset_postdata();
            ?>
        </div>
    </div>
0 Answers
Related