Php Wordpress owl转盘添加空项

Php Wordpress owl转盘添加空项,php,wordpress,owl-carousel,Php,Wordpress,Owl Carousel,在我的主题(称为meteroite)中,我有一个关于预装小部件的问题。完整的小部件代码(如果需要)如下所示: 这正是负责显示我的所有CPT“员工”项目的部分: $employees = new WP_Query(array( 'no_found_rows' => true, 'post_status' => 'publish', 'post_type' => 'empl

在我的主题(称为meteroite)中,我有一个关于预装小部件的问题。完整的小部件代码(如果需要)如下所示:

这正是负责显示我的所有CPT“员工”项目的部分:

$employees = new WP_Query(array(
            'no_found_rows'     => true,
            'post_status'       => 'publish',
            'post_type'         => 'employees',
            'posts_per_page'    => $number,
            'employee-category' => $category
        ) );

        $type_class = '';
        if ( $type == 'Square' ) :
            $type_class = 'square';
        elseif ( $type == 'Round' ) :
            $type_class = 'round';
        endif;

        $data_autoplay = 'false';
        if ( $enable_autoplay == 'On' ) :
            $data_autoplay = intval($autoplay);
        endif;

        $data_pagination = 'false';
        if ( $pagination == 'Show' ) :
            $data_pagination = 'true';
        endif;

        $centered_class = '';
        if ( $center_content == 'Yes' ) :
            $centered_class = 'centered';
        endif;

        $animation_class = '';
        $animation_single = '';
        if ( $animation == 'Fade In' ) {
            $animation_class = 'fade-in';
        } elseif ( $animation == 'Fade In Up' ) {
            $animation_class = 'fade-in-up';
        } elseif ( $animation == 'Fade In Left' ) {
            $animation_class = 'fade-in-left';
        } elseif ( $animation == 'Fade In Right' ) {
            $animation_class = 'fade-in-right';
        } elseif ( $animation == 'Fade In One By One' ) {
            $animation_single = 'fade-in-single';
        } elseif ( $animation == 'Fade In Up One By One' ) {
            $animation_single = 'fade-in-up-single';
        }

        echo $args['before_widget'];

        if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; }

        if ( $employees->have_posts() && post_type_exists( 'employees' )  ) : ?>

        <div class="meteorite-team carousel owl-carousel <?php echo $centered_class . ' ' . $animation_class . $animation_single; ?>" data-items-large="<?php echo $itemsLarge; ?>" data-items-medium="<?php echo $itemsMedium; ?>" data-items-small="<?php echo $itemsSmall; ?>" data-autoplay="<?php echo $data_autoplay; ?>" data-pagination="<?php echo $data_pagination; ?>">
            <?php while ( $employees->have_posts() ) : $employees->the_post(); ?>
                <?php //Get the custom field values
                    $position       = get_post_meta( get_the_ID(), 'tt-position', true );
                    $socialOne      = get_post_meta( get_the_ID(), 'tt-socialOne', true );
                    $socialTwo      = get_post_meta( get_the_ID(), 'tt-socialTwo', true );
                    $socialThree    = get_post_meta( get_the_ID(), 'tt-socialThree', true );
                    $empMail        = get_post_meta( get_the_ID(), 'tt-mail', true );
                    $link           = get_post_meta( get_the_ID(), 'tt-custom-link', true );
                ?>
                <div class="team-item meteorite-item <?php echo $type_class; ?>">
                    <div class="team-inner">
                        <?php if ( has_post_thumbnail() ) : ?>
                        <div class="avatar">
                            <?php the_post_thumbnail(); ?>
                        </div>
                        <?php endif; ?>
                        <div class="team-content">
                            <div class="name">
                                <?php if ( $link == '' ) : ?>
                                    <?php the_title(); ?>
                                <?php else : ?>
                                    <a href="<?php echo esc_url( $link ); ?>"><?php the_title(); ?></a>
                                <?php endif; ?>
                            </div>
                            <div class="pos"><?php echo esc_html( $position ); ?></div>
                            <div class="excerpt">
                                <?php the_content(); ?>
                            </div>
                        </div>
                        <div class="team-social">
                            <ul class="team-social social-icons">
                                <?php if ( $socialOne != '' ) : ?>
                                    <li><a href="<?php echo esc_url( $socialOne ); ?>" target="_blank"></a></li>
                                <?php endif; ?>
                                <?php if ( $socialTwo != '' ) : ?>
                                    <li><a href="<?php echo esc_url( $socialTwo ); ?>" target="_blank"></a></li>
                                <?php endif; ?>
                                <?php if ( $socialThree != '' ) : ?>
                                    <li><a href="<?php echo esc_url( $socialThree ); ?>" target="_blank"></a></li>
                                <?php endif; ?>
                                <?php if ( $empMail != '' ) : ?>
                                    <li><a href="mailto:<?php echo sanitize_email( $empMail ); ?>"></a></li>
                                <?php endif; ?>
                            </ul>
                        </div>
                    </div>
                </div>
            <?php endwhile; ?>
        </div>

        <?php
        wp_reset_postdata(); ?>
$employees=新的WP\u查询(数组(
“找不到行”=>真,
“发布状态”=>“发布”,
“职位类型”=>“员工”,
“每页帖子数”=>$number,
“员工类别”=>$category
) );
$type_class='';
如果($type=='Square'):
$type_class='square';
elseif($type=='Round'):
$type_class='round';
endif;
$data_autoplay='false';
如果($enable_autoplay=='On'):
$data_autoplay=intval($autoplay);
endif;
$data_pagination='false';
如果($pagination=='Show'):
$data_pagination='true';
endif;
$centered_class='';
如果($center_content=='Yes'):
$centered_class='centered';
endif;
$animation_class='';
$animation_single='';
如果($animation==“淡入”){
$animation_class=‘淡入’;
}elseif($animation=='Fade-In-Up'){
$animation_class=‘淡入淡出’;
}elseif($animation=='Fade In Left'){
$animation_class='fade in left';
}elseif($animation=='Fade In Right'){
$animation_class='fade in right';
}elseif($animation==‘逐个淡入’){
$animation_single='fade in single';
}elseif($animation==‘逐个淡入’){
$animation_single='fade in up single';
}
echo$args['before_widget'];
if($title){echo$args['before_title'].$title.$args['before_title'];}
如果($employees->have_posts()&&post_type_存在('employees'):?>