From e3914b7f15425cd9cbb410025fa84f74bb22dc4e Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Mon, 16 Sep 2024 15:22:27 -0300 Subject: [PATCH] Version 0.3.4. --- tainacan-blocksy/README.txt | 7 +- tainacan-blocksy/functions.php | 4 +- .../single-elements/items-related-to-this.php | 71 ++++++++++++++----- tainacan-blocksy/package-lock.json | 4 +- tainacan-blocksy/package.json | 2 +- ...acan-item-single-items-related-to-this.php | 4 +- 6 files changed, 67 insertions(+), 25 deletions(-) diff --git a/tainacan-blocksy/README.txt b/tainacan-blocksy/README.txt index 86aedc4..89974c9 100644 --- a/tainacan-blocksy/README.txt +++ b/tainacan-blocksy/README.txt @@ -3,9 +3,9 @@ Author: tainacan Contributors: wetah, vnmedeiros, leogermani, tainacan Tags: museums, archives, collections, tainacan, blocksy Requires at least: 5.9 -Tested up to: 6.5 +Tested up to: 6.6 Requires PHP: 7.0 -Stable tag: 0.3.3 +Stable tag: 0.3.4 Requires Plugins: tainacan License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -59,6 +59,9 @@ License details: https://github.com/tainacan/blocksy-tainacan/blob/master/LICENS == Changelog == += 0.3.4 = +* Adds support for variable items width in related items carousel + = 0.3.3 = * Adds support for horizontal filters options * Basic styles for mosaic view mode diff --git a/tainacan-blocksy/functions.php b/tainacan-blocksy/functions.php index 52239c4..832a0e3 100644 --- a/tainacan-blocksy/functions.php +++ b/tainacan-blocksy/functions.php @@ -4,7 +4,7 @@ Plugin Name: Tainacan Support for Blocksy Plugin URI: https://tainacan.org/ Description: Tainacan plugin support for Blocksy theme Author: tainacan -Version: 0.3.3 +Version: 0.3.4 Text Domain: tainacan-blocksy License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -15,7 +15,7 @@ if (! defined('WP_DEBUG') ) { } /** Theme/plugin version */ -const TAINACAN_BLOCKSY_VERSION = '0.3.3'; +const TAINACAN_BLOCKSY_VERSION = '0.3.4'; const TAINACAN_BLOCKSY_IS_CHILD_THEME = false; /* Tools to define our next constants */ 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 0c15daa..8db8380 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 @@ -46,23 +46,6 @@ $inner_options = [ 'choices' => $layout_choices, 'sync' => '', ], - blocksy_rand_md5() => [ - 'type' => 'ct-condition', - 'condition' => [ - $prefix . 'items_related_to_this_layout' => 'carousel' - ], - 'options' => [ - $prefix . 'items_related_to_this_max_items_per_screen' => [ - 'label' => __( 'Max amount of items per slide', 'tainacan-blocksy' ), - 'type' => 'ct-number', - 'design' => 'inline', - 'value' => 6, - 'min' => 1, - 'max' => 10, - 'sync' => '' - ] - ] - ], blocksy_rand_md5() => [ 'type' => 'ct-condition', 'condition' => [ @@ -157,6 +140,60 @@ if ( null !== TAINACAN_VERSION && version_compare( TAINACAN_VERSION, '0.21.5' ) ]; } +if ( null !== TAINACAN_VERSION && version_compare( TAINACAN_VERSION, '0.21.8' ) >= 0 ) { + $inner_options[blocksy_rand_md5()] = [ + 'type' => 'ct-condition', + 'condition' => [ + $prefix . 'items_related_to_this_layout' => 'carousel', + $prefix . 'items_related_to_this_variable_items_width' => 'no', + ], + 'options' => [ + $prefix . 'items_related_to_this_max_items_per_screen' => [ + 'label' => __( 'Max amount of items per slide', 'tainacan-blocksy' ), + 'type' => 'ct-number', + 'design' => 'inline', + 'value' => 6, + 'min' => 1, + 'max' => 10, + 'sync' => '' + ] + ] + ]; + $inner_options[blocksy_rand_md5()] = [ + 'type' => 'ct-condition', + 'condition' => [ + $prefix . 'items_related_to_this_layout' => 'carousel' + ], + 'options' => [ + $prefix . 'items_related_to_this_variable_items_width' => [ + 'label' => __( 'Variable items width', 'tainacan-blocksy' ), + 'type' => 'ct-switch', + 'value' => 'no', + 'desc' => __( 'Toggle to define each slide size based on its content natural width.', 'tainacan-blocksy' ), + 'sync' => '' + ] + ] + ]; +} else { + $inner_options[blocksy_rand_md5()] = [ + 'type' => 'ct-condition', + 'condition' => [ + $prefix . 'items_related_to_this_layout' => 'carousel', + ], + 'options' => [ + $prefix . 'items_related_to_this_max_items_per_screen' => [ + 'label' => __( 'Max amount of items per slide', 'tainacan-blocksy' ), + 'type' => 'ct-number', + 'design' => 'inline', + 'value' => 6, + 'min' => 1, + 'max' => 10, + 'sync' => '' + ] + ] + ]; +} + $options = [ $prefix . 'display_items_related_to_this' => [ 'label' => __( 'Display "Items related to this"', 'tainacan-blocksy' ), diff --git a/tainacan-blocksy/package-lock.json b/tainacan-blocksy/package-lock.json index 29a5e95..18c1764 100644 --- a/tainacan-blocksy/package-lock.json +++ b/tainacan-blocksy/package-lock.json @@ -1,12 +1,12 @@ { "name": "tainacan-blocksy", - "version": "0.3.3", + "version": "0.3.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tainacan-blocksy", - "version": "0.3.3", + "version": "0.3.4", "license": "ISC", "devDependencies": { "clean-css-cli": "^4.3.0", diff --git a/tainacan-blocksy/package.json b/tainacan-blocksy/package.json index 41d6340..8dae35e 100644 --- a/tainacan-blocksy/package.json +++ b/tainacan-blocksy/package.json @@ -1,6 +1,6 @@ { "name": "tainacan-blocksy", - "version": "0.3.3", + "version": "0.3.4", "description": "A Blocksy plugin/child theme compatible with Tainacan", "main": "index.js", "scripts": { 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 d39837b..536b9c5 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 @@ -5,6 +5,7 @@ $items_related_to_this_layout = get_theme_mod( $prefix . '_items_related_to_this_layout', 'carousel' ); $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 ); + $variable_items_width = get_theme_mod( $prefix . '_items_related_to_this_variable_items_width', 'no') === 'yes'; $max_items_number = get_theme_mod( $prefix . '_items_related_to_this_max_items_number', 12 ); $order_option = get_theme_mod( $prefix . '_items_related_to_this_order', 'title_asc' ); $hide_collection_heading = get_theme_mod( $prefix . '_items_related_to_this_hide_collection_heading', 'no' ) === 'yes'; @@ -49,7 +50,8 @@ ], 'carousel_args' => [ 'max_items_per_screen' => $max_items_per_screen, - 'image_size' => $image_size + 'image_size' => $image_size, + 'variable_items_width' => $variable_items_width, ] ]); ?>