From d45adb87d3dced1f50c9ef383938236e2f981eff Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Fri, 17 May 2024 17:09:20 -0300 Subject: [PATCH] Adds media gallery thumbnails image size option. --- .../inc/options/single-elements/attachments-size.php | 11 +++++++++++ .../tainacan-item-single-attachments_new.php | 4 +++- .../tainacan-item-single-document_new.php | 4 +++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tainacan-blocksy/inc/options/single-elements/attachments-size.php b/tainacan-blocksy/inc/options/single-elements/attachments-size.php index 5ba5778..7c00a74 100644 --- a/tainacan-blocksy/inc/options/single-elements/attachments-size.php +++ b/tainacan-blocksy/inc/options/single-elements/attachments-size.php @@ -5,6 +5,17 @@ if (! isset($prefix)) { } $options = [ + $prefix . 'thumbnails_image_size' => [ + 'label' => __('Thumbnails image size', 'blocksy'), + 'type' => 'ct-select', + 'value' => 'tainacan-medium', + 'view' => 'text', + 'design' => 'inline', + 'sync' => '', + 'choices' => blocksy_ordered_keys( + blocksy_get_all_image_sizes() + ), + ], $prefix . 'attachments_size' => [ 'label' => __( 'Attachments size on carousel', 'tainacan-blocksy' ), 'type' => 'ct-slider', diff --git a/tainacan-blocksy/template-parts/tainacan-item-single-attachments_new.php b/tainacan-blocksy/template-parts/tainacan-item-single-attachments_new.php index 4518930..6dc70bf 100644 --- a/tainacan-blocksy/template-parts/tainacan-item-single-attachments_new.php +++ b/tainacan-blocksy/template-parts/tainacan-item-single-attachments_new.php @@ -17,6 +17,7 @@ $hide_file_caption_lightbox = get_theme_mod( $prefix . '_hide_files_caption_lightbox', 'no') == 'yes'; $hide_file_description_lightbox = get_theme_mod( $prefix . '_hide_files_description_lightbox', 'no') == 'yes'; $has_light_dark_color_scheme = get_theme_mod( $prefix . '_gallery_color_scheme', 'dark' ) == 'light'; + $thumbnails_image_size = get_theme_mod( $prefix . '_thumbnails_image_size', 'tainacan-medium' ); if ( $is_gallery_mode && $gallery_position !== 'below' ) { add_filter( 'tainacan-swiper-thumbs-options', function($options) { @@ -78,7 +79,8 @@ 'hideFileCaptionLightbox' => $hide_file_caption_lightbox, 'hideFileDescriptionLightbox' => $hide_file_description_lightbox, 'openLightboxOnClick' => $is_gallery_mode ? !$disable_gallery_lightbox : true, - 'lightboxHasLightBackground' => $has_light_dark_color_scheme + 'lightboxHasLightBackground' => $has_light_dark_color_scheme, + 'thumbnailsSize' => $thumbnails_image_size ]); ?> diff --git a/tainacan-blocksy/template-parts/tainacan-item-single-document_new.php b/tainacan-blocksy/template-parts/tainacan-item-single-document_new.php index 724b405..6744dee 100644 --- a/tainacan-blocksy/template-parts/tainacan-item-single-document_new.php +++ b/tainacan-blocksy/template-parts/tainacan-item-single-document_new.php @@ -15,6 +15,7 @@ $hide_file_caption_lightbox = get_theme_mod( $prefix . '_hide_files_caption_lightbox', 'no') == 'yes'; $hide_file_description_lightbox = get_theme_mod( $prefix . '_hide_files_description_lightbox', 'no') == 'yes'; $has_light_dark_color_scheme = get_theme_mod( $prefix . '_gallery_color_scheme', 'dark' ) == 'light'; + $thumbnails_image_size = get_theme_mod( $prefix . '_thumbnails_image_size', 'tainacan-medium' ); if ( $gallery_spacing === 'minimum' ) { add_filter( 'tainacan-swiper-thumbs-options', function($options) { @@ -54,7 +55,8 @@ 'hideFileCaptionLightbox' => $hide_file_caption_lightbox, 'hideFileDescriptionLightbox' => $hide_file_description_lightbox, 'openLightboxOnClick' => $is_gallery_mode ? !$disable_gallery_lightbox : true, - 'lightboxHasLightBackground' => $has_light_dark_color_scheme + 'lightboxHasLightBackground' => $has_light_dark_color_scheme , + 'thumbnailsSize' => $thumbnails_image_size ]); ?>