<?php
/**
 * Shortcode attributes
 * @var $atts
 * @var $number
 * @var $text
 */

if( !function_exists('yolo_shortcode_video') ){
    function yolo_shortcode_video($atts){
        extract(shortcode_atts(array(
            'style'          => 'index-1',
            'video_url'      =>  '',
            'featured_image' =>  '',
            ),$atts));
        ob_start();
         $image2 = '';

        if( isset( $featured_image ) && !empty( $featured_image ) ){
          $bk_array = wp_get_attachment_image_src( $featured_image,'full' );
          $image2 = $bk_array[0];
        }
        wp_enqueue_script( 'yolo-vendor-nivo-lightbox-js' );
        wp_enqueue_style( 'yolo-vendor-nivo-lightbox-default-css' );
        ?>
        <div class="yolo-video <?php echo esc_attr($style); ?>" style="background-image: url('<?php echo esc_attr($image2); ?>')" >
          <a href="<?php echo esc_attr($video_url); ?>" class="video-btn">
            <i class="fa fa-play"></i>
          </a>    
        </div>
        <script>
          jQuery(document).ready(function($){
            $('a.video-btn').nivoLightbox();
          });
        </script>
       <?php
       $information = ob_get_contents();
       ob_end_clean();
       return $information;
   }
   add_shortcode('yolo_video','yolo_shortcode_video');
}
?>