diff --git a/lib/teksttv.php b/lib/teksttv.php index 4c93414..79701c9 100644 --- a/lib/teksttv.php +++ b/lib/teksttv.php @@ -134,31 +134,30 @@ private function get_article_slides($block) } } - // Skip if this post isn't for TekstTV - $kabelkrant_content = get_field('post_kabelkrant_content', get_the_ID()); - if (empty($kabelkrant_content)) { - continue; - } - // Get the primary category image for the post $slide_image = $this->get_primary_category_image(get_the_ID()); - // Split content by pages using "---" as a delimiter - $pages = preg_split('/\n*-{3,}\n*/', $kabelkrant_content); - - // Generate a slide for each page of content - foreach ($pages as $index => $page_content) { - $slides[] = [ - 'type' => 'text', - 'duration' => 25000, // 25 seconds per slide, adjust as needed - 'title' => get_the_title(), - 'body' => wpautop(trim($page_content)), - 'image' => !empty($slide_image) ? $slide_image : null, - ]; + // Check for content or extra images + $kabelkrant_content = get_field('post_kabelkrant_content', get_the_ID()); + $extra_images = get_field('post_kabelkrant_extra_afbeeldingen', get_the_ID()); + + if (!empty($kabelkrant_content)) { + // Split content by pages using "---" as a delimiter + $pages = preg_split('/\n*-{3,}\n*/', $kabelkrant_content); + + // Generate a slide for each page of content + foreach ($pages as $index => $page_content) { + $slides[] = [ + 'type' => 'text', + 'duration' => 20000, // 20 seconds per slide, adjust as needed + 'title' => get_the_title(), + 'body' => wpautop(trim($page_content)), + 'image' => !empty($slide_image) ? $slide_image : null, + ]; + } } - // Add extra images (if any) as separate slides - $extra_images = get_field('post_kabelkrant_extra_afbeeldingen', get_the_ID()); + // Add extra images (if any) as separate slides, even if content is empty if (!empty($extra_images)) { foreach ($extra_images as $image) { if (!empty($image['url'])) { @@ -190,7 +189,7 @@ private function get_primary_category_image($post_id) } } - // We fall back to post thumbnail if no primary category image + // Fall back to post thumbnail if no primary category image return get_the_post_thumbnail_url($post_id, 'large'); } diff --git a/streekomroep-acf-json/group_5f21a05a18b57.json b/streekomroep-acf-json/group_5f21a05a18b57.json index 3418f11..d786f04 100644 --- a/streekomroep-acf-json/group_5f21a05a18b57.json +++ b/streekomroep-acf-json/group_5f21a05a18b57.json @@ -49,7 +49,7 @@ "aria-label": "", "type": "textarea", "instructions": "", - "required": 1, + "required": 0, "conditional_logic": [ [ { @@ -66,6 +66,7 @@ }, "default_value": "", "maxlength": "", + "allow_in_bindings": 1, "rows": 7, "placeholder": "Vul de versie voor op teksttv in", "new_lines": "" @@ -259,5 +260,5 @@ "active": true, "description": "", "show_in_rest": 0, - "modified": 1728769658 + "modified": 1729879906 } diff --git a/style.css b/style.css index e084d97..4e2d5a1 100644 --- a/style.css +++ b/style.css @@ -2,5 +2,5 @@ * Theme Name: Streekomroep * Description: This is a WordPress theme made for Streekomroep ZuidWest in the Netherlands. It's made using Timber and Tailwind CSS and provides functionality for regional news, radio and television broadcasts. * Author: Streekomroep ZuidWest - * Version: 1.10.0-beta6 + * Version: 1.10.0-beta7 */