<div class="wpex-slider-slides sp-slides"> <?php // Loop through attachments foreach ($attachments as $attachment => $custom_link) { ?> <?php // Define main vars $custom_link = '#' != $custom_link ? $custom_link : ''; $attachment_link = get_post_meta($attachment, '_wp_attachment_url', true); $attachment_data = wpex_get_attachment_data($attachment); $caption_type = $caption_type ? $caption_type : 'caption'; $caption_output = $attachment_data[$caption_type]; $attachment_video = wp_oembed_get($attachment_data['video']); $attachment_video = wpex_add_sp_video_to_oembed($attachment_video); // Generate img HTML $attachment_img = wpex_get_post_thumbnail(array('attachment' => $attachment, 'size' => $img_size, 'crop' => $img_crop, 'width' => $img_width, 'height' => $img_height, 'alt' => $attachment_data['alt'])); ?> <div class="wpex-slider-slide sp-slide"> <div class="wpex-slider-media"> <?php // Check if the current attachment has a video if ($attachment_video) { ?> <div class="wpex-slider-video responsive-video-wrap"> <?php
/** * Returns correct blog slider video embed code * Adds unique class for the slider * * @since 2.0.0 * @return array */ function wpex_blog_slider_video($attachment) { $video = get_post_meta($attachment, '_video_url', true); $video = wp_oembed_get(esc_url($video)); $video = wpex_add_sp_video_to_oembed($video); return $video; }