From 457c329237f97069063e641b10f384a52d584f21 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 12 May 2026 17:50:11 +0000
Subject: [PATCH] =minor tweaks
---
inc/blocks/VideoCoverBlock.php | 26 +++++---------------------
1 files changed, 5 insertions(+), 21 deletions(-)
diff --git a/inc/blocks/VideoCoverBlock.php b/inc/blocks/VideoCoverBlock.php
index cb70517..d6e753e 100644
--- a/inc/blocks/VideoCoverBlock.php
+++ b/inc/blocks/VideoCoverBlock.php
@@ -1,7 +1,6 @@
<?php
namespace JVBase\blocks;
-use JVBase\blocks\CustomBlocks;
if (!defined('ABSPATH')) {
exit;
}
@@ -55,14 +54,17 @@
//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;
// 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
@@ -94,29 +96,11 @@
$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 .= '>';
}
}
--
Gitblit v1.10.0