From 64a66ff2cc58b1bce3fb41593e06b6f8f72dba6a Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Thu, 17 Mar 2022 12:38:19 -0300 Subject: [PATCH] Avoids displaying thumbnails if main carousel exists and there is less than two media items. --- src/classes/theme-helper/class-tainacan-theme-helper.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/classes/theme-helper/class-tainacan-theme-helper.php b/src/classes/theme-helper/class-tainacan-theme-helper.php index 8814169bb..fed1ef8c5 100644 --- a/src/classes/theme-helper/class-tainacan-theme-helper.php +++ b/src/classes/theme-helper/class-tainacan-theme-helper.php @@ -1201,6 +1201,7 @@ class Theme_Helper { if ($document_type === 'attachment') { // Uses this moment to also see if we have an image + $attachment = get_post(tainacan_get_the_document_raw($item_id)); $media_includes_images = wp_attachment_is('image', $attachment->ID); } else if ($document_type === 'url') { $document_options = $item->get_document_options(); @@ -1266,6 +1267,11 @@ class Theme_Helper { } } + // Make sure we have more than one media item otherwise + // we don't need to show thumbnails if the main carousel exists + if ( $layout_elements['main'] && count($media_items_main) <= 1 ) + $layout_elements['thumbnails'] = false; + if ( $layout_elements['thumbnails'] ) { $class_slide_metadata = '';