Adds tainacan view mode layout options to related items section.

This commit is contained in:
mateuswetah 2024-05-17 17:18:19 -03:00
parent 4f2a131044
commit 780395e38a
4 changed files with 28 additions and 8 deletions

View File

@ -638,10 +638,10 @@
} }
.single-item-collection--related-items { .single-item-collection--related-items {
.wp-block-tainacan-carousel-related-items { .wp-block-tainacan-carousel-related-items {
h3 { .wp-block-group__inner-container > h3 {
font-size: 1rem !important; font-size: 1rem !important;
} }
p { .wp-block-group__inner-container > p {
font-size: 0.875rem; font-size: 0.875rem;
} }
} }

View File

@ -173,6 +173,17 @@ if ( ! function_exists( 'tainacan_get_single_item_related_items_layout_options'
'grid' => __('Grid of items, with large thumbnails', 'tainacan-interface'), 'grid' => __('Grid of items, with large thumbnails', 'tainacan-interface'),
'list' => __('List of items, with smaller thumbnails', 'tainacan-interface') 'list' => __('List of items, with smaller thumbnails', 'tainacan-interface')
); );
if ( version_compare(TAINACAN_VERSION, '0.20.3') >= 0 ) {
$tainacan_view_modes = tainacan_get_default_view_mode_choices();
$tainacan_view_modes_options = array();
foreach ($tainacan_view_modes['enabled_view_modes'] as $key => $value) {
$tainacan_view_modes_options['tainacan-view-mode-' . $key] = $value;
}
$related_items_layout_options = array_merge(
$related_items_layout_options,
$tainacan_view_modes_options
);
}
return $related_items_layout_options; return $related_items_layout_options;
} }
endif; // tainacan_get_single_item_related_items_layout_options endif; // tainacan_get_single_item_related_items_layout_options

File diff suppressed because one or more lines are too long

View File

@ -25,20 +25,29 @@ if ( function_exists('tainacan_the_related_items_carousel') && get_theme_mod('ta
<div class="single-item-collection--related-items justify-content-center"> <div class="single-item-collection--related-items justify-content-center">
<div class="row"> <div class="row">
<?php <?php
tainacan_the_related_items_carousel([ $related_items_layout = get_theme_mod('tainacan_single_item_related_items_layout', 'carousel');
$tainacan_view_mode = '';
if ( strpos($related_items_layout, 'tainacan-view-mode-') !== false ) {
$tainacan_view_mode = str_replace('tainacan-view-mode-', '', $related_items_layout);
$related_items_layout = 'tainacan-view-modes';
}
$related_items_options = [
// 'class_name' => 'mt-2 tainacan-single-post', // 'class_name' => 'mt-2 tainacan-single-post',
// 'collection_heading_class_name' => 'title-content-items', // 'collection_heading_class_name' => 'title-content-items',
'items_list_layout' => get_theme_mod( 'tainacan_single_item_related_items_layout', 'carousel' ), 'items_list_layout' => $related_items_layout,
'collection_heading_tag' => 'h3', 'collection_heading_tag' => 'h3',
'order' => $order, 'order' => $order,
'orderby' => $order_by, 'orderby' => $order_by,
'dynamic_items_args' => [ 'dynamic_items_args' => [
'max_columns_count' => get_theme_mod('tainacan_single_item_related_items_max_columns_count', 4) 'max_columns_count' => get_theme_mod('tainacan_single_item_related_items_max_columns_count', 4),
'tainacan_view_mode' => $tainacan_view_mode
], ],
'carousel_args' => [ 'carousel_args' => [
'max_items_per_screen' => get_theme_mod('tainacan_single_item_related_items_max_items_per_screen', 6) 'max_items_per_screen' => get_theme_mod('tainacan_single_item_related_items_max_items_per_screen', 6)
] ]
]); ];
tainacan_the_related_items_carousel($related_items_options);
?> ?>
</div> </div>
<div> <div>