| | |
| | | <?php |
| | | namespace JVBase\blocks; |
| | | |
| | | use JVBase\blocks\CustomBlocks; |
| | | if (!defined('ABSPATH')) { |
| | | exit; |
| | | } |
| | |
| | | //Get date of current post |
| | | global $post; |
| | | $date = date('c',strtotime($post->post_date)); |
| | | $title = $attributes['title'] ?? $post->post_title; |
| | | $description = $attributes['description'] ?? $post->post_excerpt; |
| | | $title = "Legacy Tattoo Removal"; |
| | | $description="A video of Madi Rawson performing laser tattoo removal treatments."; |
| | | |
| | | // If no video sources, return empty |
| | | if (empty($video_sources)) { |
| | | return ''; |
| | | } |
| | | |
| | | $video_id = $video_sources[0]['id'] ?? 0; |
| | | $video_post = $video_id ? get_post($video_id) : null; |
| | | $title = $video_post->post_title ?? $post->post_title; |
| | | $description = $video_post->post_content ?? $post->post_excerpt; |
| | | |
| | | |
| | | |
| | | // Get poster URL |
| | |
| | | |
| | | $html .= ' fetch-priority="high">'; |
| | | |
| | | // Add mobile sources first (lower resolution) |
| | | foreach ($mobile_sources as $source) { |
| | | if (!empty($source['url']) && !empty($source['mime'])) { |
| | | $html .= '<source'; |
| | | $html .= ' data-src="' . esc_url($source['url']) . '"'; |
| | | $html .= ' type="' . esc_attr($source['mime']) . '"'; |
| | | $html .= ' media="(max-width: 767px)"'; |
| | | $html .= '>'; |
| | | } |
| | | } |
| | | |
| | | // Add desktop sources |
| | | foreach ($video_sources as $source) { |
| | | if (!empty($source['url']) && !empty($source['mime'])) { |
| | | $html .= '<source'; |
| | | $html .= ' data-src="' . esc_url($source['url']) . '"'; |
| | | $html .= ' type="' . esc_attr($source['mime']) . '"'; |
| | | |
| | | // Add media query for desktop if mobile sources exist |
| | | if (!empty($mobile_sources)) { |
| | | $html .= ' media="(min-width: 768px)"'; |
| | | } |
| | | |
| | | $html .= '>'; |
| | | } |
| | | } |