不显示结果内容-自定义类型

Display no result content - custom type

我使用 ACF (Wordpress) 创建自定义类型

如果类别中没有内容,我想显示一个'no result message'

我的代码

<?php
        $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
        $loop = new WP_Query( array( 
                'post_type' => 'event',
                'posts_per_page' => -1,
                'paged'          => $paged )
        );
        if ( $loop->have_posts() ):
        while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <div class="container-fluid" id="events" itemscope itemtype="https://schema.org/Event">
        <div class="row row-eq-height align-items-center alignrow">
            <div class="col-md-12">
                
            </div>
            
            
        </div>
    </div>
        <?php endwhile; ?>
        <?php wp_reset_postdata(); ?>
    
        <?php endif; ?>

找到了

<?php
        $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
        $loop = new WP_Query( array( 
                'post_type' => 'event',
                'posts_per_page' => -1,
                'paged'          => $paged )
        );
        if ( $loop->have_posts() ):
        while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <div class="container-fluid" id="events" itemscope itemtype="https://schema.org/Event">
        <div class="row row-eq-height align-items-center alignrow">
            <div class="col-md-12">
                
            </div>
            
            
        </div>
    </div>
        <?php endwhile; ?>
        <?php else: ?>
        no result here
       <?php endif; ?>