Skip to content

Commit

Permalink
Avoids displaying thumbnails if main carousel exists and there is les…
Browse files Browse the repository at this point in the history
…s than two media items.
  • Loading branch information
mateuswetah committed Mar 17, 2022
1 parent f604c8b commit 64a66ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/classes/theme-helper/class-tainacan-theme-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ public function get_tainacan_item_gallery($args = []) {

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();
Expand Down Expand Up @@ -1266,6 +1267,11 @@ public function get_tainacan_item_gallery($args = []) {
}
}

// 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 = '';
Expand Down

0 comments on commit 64a66ff

Please sign in to comment.