<?php
if(isset($settings['items']) && !empty($settings['items']) && count($settings['items'])):
$image_size = !empty($settings['img_size']) ? $settings['img_size'] : '580x383'; ?>
    <div class="pxl-image-marquee pxl-image-marquee1 pxl-text-slide1 <?php echo esc_attr($settings['style']); ?>">
        <div class="pxl-text-slide <?php echo esc_attr($settings['effect']); ?>" <?php if(!empty($settings['effect_speed'])) { ?>style="animation-duration:<?php echo esc_attr($settings['effect_speed']); ?>ms"<?php } ?>>
            <?php foreach ($settings['items'] as $key => $value):
                $image = isset($value['image']) ? $value['image'] : '';
                $text = isset($value['text']) ? $value['text'] : '';
                if(!empty($text)) : ?>
                    <div class="pxl--item <?php echo esc_attr($settings['pxl_animate']); ?>" data-wow-delay="<?php echo esc_attr($settings['pxl_animate_delay']); ?>ms">
                        <?php if(!empty($image['id'])) { 
                            $img = pxl_get_image_by_size( array(
                                'attach_id'  => $image['id'],
                                'thumb_size' => $image_size,
                                'class' => 'no-lazyload',
                            ));
                            $thumbnail = $img['thumbnail'];
                            ?>
                            <div class="pxl-image">
                                <?php echo wp_kses_post($thumbnail); ?>
                            </div>
                        <?php } ?>
                        <div class="pxl-item--text"><span><?php echo pxl_print_html($text); ?></span></div>
                    </div>
                <?php endif; ?>
            <?php endforeach; ?>
        </div>
        <div class="pxl-text-fixed">
            <?php foreach ($settings['items'] as $key => $value):
                $image = isset($value['image']) ? $value['image'] : '';
                $text = isset($value['text']) ? $value['text'] : '';
                if(!empty($text)) : ?>
                    <div class="pxl--item <?php echo esc_attr($settings['pxl_animate']); ?>" data-wow-delay="<?php echo esc_attr($settings['pxl_animate_delay']); ?>ms">
                        <?php if(!empty($image['id'])) { 
                            $img = pxl_get_image_by_size( array(
                                'attach_id'  => $image['id'],
                                'thumb_size' => $image_size,
                                'class' => 'no-lazyload',
                            ));
                            $thumbnail = $img['thumbnail'];
                            ?>
                            <div class="pxl-image">
                                <?php echo wp_kses_post($thumbnail); ?>
                            </div>
                        <?php } ?>
                        <div class="pxl-item--text"><span><?php echo pxl_print_html($text); ?></span></div>
                    </div>
                <?php endif; ?>
            <?php endforeach; ?>
        </div>
    </div>
<?php endif; ?>
