From 6ef60f3aad7e1dc2eba807c98c9ce8aad1b9da19 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Thu, 1 Jun 2023 16:02:40 -0300 Subject: [PATCH] Adds option to set items related to this image size. --- .../single-elements/items-related-to-this.php | 13 ++++++++++++- .../tainacan-item-single-items-related-to-this.php | 8 ++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tainacan-blocksy/inc/options/single-elements/items-related-to-this.php b/tainacan-blocksy/inc/options/single-elements/items-related-to-this.php index 36d10d6..8ce40ba 100644 --- a/tainacan-blocksy/inc/options/single-elements/items-related-to-this.php +++ b/tainacan-blocksy/inc/options/single-elements/items-related-to-this.php @@ -90,7 +90,18 @@ $options = [ 'choices' => blocksy_ordered_keys( $order_options ) - ] + ], + $prefix . 'items_related_to_this_image_size' => [ + 'label' => __('Image size', 'blocksy'), + 'type' => 'ct-select', + 'value' => 'tainacan-medium', + 'view' => 'text', + 'design' => 'inline', + 'sync' => '', + 'choices' => blocksy_ordered_keys( + blocksy_get_all_image_sizes() + ), + ], ] ] ]; \ No newline at end of file diff --git a/tainacan-blocksy/template-parts/tainacan-item-single-items-related-to-this.php b/tainacan-blocksy/template-parts/tainacan-item-single-items-related-to-this.php index 21feac8..9c76107 100644 --- a/tainacan-blocksy/template-parts/tainacan-item-single-items-related-to-this.php +++ b/tainacan-blocksy/template-parts/tainacan-item-single-items-related-to-this.php @@ -6,6 +6,8 @@ $max_columns_count = get_theme_mod( $prefix . '_items_related_to_this_max_columns_count', 4 ); $max_items_per_screen = get_theme_mod( $prefix . '_items_related_to_this_max_items_per_screen', 6 ); $order_option = get_theme_mod( $prefix . '_items_related_to_this_order', 'title_asc' ); + + $image_size = get_theme_mod($prefix . '_items_related_to_this_image_size', 'tainacan-medium'); $order_option_split = explode( '_', $order_option ); $order_by = $order_option_split[0] ? $order_option_split[0] : 'title'; @@ -34,10 +36,12 @@ 'order' => $order, 'orderby' => $order_by, 'dynamic_items_args' => [ - 'max_columns_count' => $max_columns_count + 'max_columns_count' => $max_columns_count, + 'image_size' => $image_size ], 'carousel_args' => [ - 'max_items_per_screen' => $max_items_per_screen + 'max_items_per_screen' => $max_items_per_screen, + 'image_size' => $image_size ] ]); ?>