Adds option to set items related to this image size.

This commit is contained in:
mateuswetah 2023-06-01 16:02:40 -03:00
parent f18928baf2
commit 6ef60f3aad
2 changed files with 18 additions and 3 deletions

View File

@ -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()
),
],
]
]
];

View File

@ -7,6 +7,8 @@
$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';
$order = $order_option_split[1] ? $order_option_split[1] : 'asc';
@ -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
]
]);
?>