diff --git a/src/assets/scss/_post.scss b/src/assets/scss/_post.scss
index 9ce3e3d..5164b1e 100644
--- a/src/assets/scss/_post.scss
+++ b/src/assets/scss/_post.scss
@@ -732,11 +732,13 @@
}
}
}
- .single-item-collection--attachments-file {
+ .single-item-collection--attachments-file,
+ .tainacan-media-component__swiper-main .swiper-slide {
&:hover {
.tainacan-item-file-download {
opacity: 1;
transform: scale(1);
+ a { background-color: transparent; }
}
}
}
@@ -794,7 +796,9 @@
}
}
.single-item-collection--information{
- .card{
+ .card {
+ background-color: transparent;
+ box-shadow: none;
.item-card--thumbnail{
height: auto;
max-width: 250px;
diff --git a/src/functions/customizer.php b/src/functions/customizer.php
index 09194b1..738e4ab 100644
--- a/src/functions/customizer.php
+++ b/src/functions/customizer.php
@@ -662,10 +662,66 @@ function tainacan_customize_register( $wp_customize ) {
'type' => 'checkbox',
'priority' => 3, // Within the section.
'section' => 'tainacan_single_item_page',
- 'label' => __( 'Hide the attchments label', 'tainacan-interface' ),
+ 'label' => __( 'Hide the attachments label (on carousel)', 'tainacan-interface' ),
'description' => __( 'Toggle to not display the document and attachments name below its thumbnail.', 'tainacan-interface' )
) );
+ if (version_compare(TAINACAN_VERSION, '0.18RC') >= 0) {
+ /**
+ * Adds options to hide attachments file names on the main slider.
+ */
+ $wp_customize->add_setting( 'tainacan_single_item_hide_files_name_main', array(
+ 'type' => 'theme_mod',
+ 'capability' => 'edit_theme_options',
+ 'default' => true,
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'tainacan_callback_sanitize_checkbox'
+ ) );
+ $wp_customize->add_control( 'tainacan_single_item_hide_files_name_main', array(
+ 'type' => 'checkbox',
+ 'priority' => 3, // Within the section.
+ 'section' => 'tainacan_single_item_page',
+ 'label' => __( 'Hide the attachments label (on the main slider)', 'tainacan-interface' ),
+ 'description' => __( 'Toggle to not display the document and attachments name.', 'tainacan-interface' )
+ ) );
+
+ /**
+ * Adds options to hide attachments file caption on the main slider.
+ */
+ $wp_customize->add_setting( 'tainacan_single_item_hide_files_caption_main', array(
+ 'type' => 'theme_mod',
+ 'capability' => 'edit_theme_options',
+ 'default' => true,
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'tainacan_callback_sanitize_checkbox'
+ ) );
+ $wp_customize->add_control( 'tainacan_single_item_hide_files_caption_main', array(
+ 'type' => 'checkbox',
+ 'priority' => 3, // Within the section.
+ 'section' => 'tainacan_single_item_page',
+ 'label' => __( 'Hide the attachments caption (on the main slider)', 'tainacan-interface' ),
+ 'description' => __( 'Toggle to not display the document and attachments caption.', 'tainacan-interface' )
+ ) );
+
+ /**
+ * Adds options to hide attachments file description on the main slider.
+ */
+ $wp_customize->add_setting( 'tainacan_single_item_hide_files_description_main', array(
+ 'type' => 'theme_mod',
+ 'capability' => 'edit_theme_options',
+ 'default' => true,
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'tainacan_callback_sanitize_checkbox'
+ ) );
+ $wp_customize->add_control( 'tainacan_single_item_hide_files_description_main', array(
+ 'type' => 'checkbox',
+ 'priority' => 3, // Within the section.
+ 'section' => 'tainacan_single_item_page',
+ 'label' => __( 'Hide the attachments description (on the main slider)', 'tainacan-interface' ),
+ 'description' => __( 'Toggle to not display the document and attachments description.', 'tainacan-interface' )
+ ) );
+ }
+
/**
* Adds options to display item author and publish date.
*/
diff --git a/src/template-parts/single-items-attachments.php b/src/template-parts/single-items-attachments.php
index 89746d3..45212ce 100644
--- a/src/template-parts/single-items-attachments.php
+++ b/src/template-parts/single-items-attachments.php
@@ -1,119 +1,7 @@
= 0) {
+ get_template_part( 'template-parts/single-items-attachments_new' );
} else {
- // compatibility with pre 0.11 tainacan plugin
- $attachments = array_values(
- get_children(
- array(
- 'post_parent' => $post->ID,
- 'post_type' => 'attachment',
- 'post_mime_type' => 'image',
- 'order' => 'ASC',
- 'numberposts' => -1,
- )
- )
- );
+ get_template_part( 'template-parts/single-items-attachments_old' );
}
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ' . tainacan_the_item_document_download_link() . '';
- }
- ?>
-
-
-
-
-
-
- ID);
- }
- if ( !get_theme_mod( 'tainacan_single_item_hide_download_document', false ) && function_exists('tainacan_the_item_attachment_download_link') && tainacan_the_item_attachment_download_link($attachment->ID) != '' ) {
- echo '' . tainacan_the_item_attachment_download_link($attachment->ID) . '';
- }
- ?>
-
-
-
-
- 0 ) || (!tainacan_has_document() && $attachments && sizeof($attachments) > 1 ) ) : ?>
-
-
-
- 'item-card--thumbnail mt-2'));
- echo '
';
- ?>
-
-
-
-
-
-
- ID, 'tainacan-interface-item-attachments', true );
- echo '
';
- ?>
- ID ); ?>
-
-
-
-
-
-
-
-
- ID);
- } else {
- $href = wp_get_attachment_url($attachment->ID, 'large');
- }
- ?>
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+?>
\ No newline at end of file
diff --git a/src/template-parts/single-items-attachments_new.php b/src/template-parts/single-items-attachments_new.php
new file mode 100644
index 0000000..2449fda
--- /dev/null
+++ b/src/template-parts/single-items-attachments_new.php
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (( !get_theme_mod( 'tainacan_single_item_hide_download_document', false ) && tainacan_the_item_document_download_link() != '' ) ?
+ ('' . tainacan_the_item_document_download_link() . '')
+ : ''),
+ 'media_content' => tainacan_get_the_document(),
+ 'media_content_full' => $is_document_type_attachment ? tainacan_get_the_document(0, 'full') : ('' . tainacan_get_the_document(0, 'full') . '
'),
+ 'media_title' => $is_document_type_attachment ? get_the_title(tainacan_get_the_document_raw()) : '',
+ 'media_description' => $is_document_type_attachment ? get_the_content(tainacan_get_the_document_raw()) : '',
+ 'media_caption' => $is_document_type_attachment ? get_the_excerpt(tainacan_get_the_document_raw()) : '',
+ 'media_type' => tainacan_get_the_document_type(),
+ 'class_slide_metadata' => $class_slide_metadata
+ ));
+ }
+
+ foreach ( $attachments as $attachment ) {
+ $media_items_main[] =
+ tainacan_get_the_media_component_slide(array(
+ 'after_slide_metadata' => (( !get_theme_mod( 'tainacan_single_item_hide_download_document', false ) && tainacan_the_item_attachment_download_link($attachment->ID) != '' ) ?
+ '' . tainacan_the_item_attachment_download_link($attachment->ID) . ''
+ : ''),
+ 'media_content' => tainacan_get_attachment_as_html($attachment->ID, 0),
+ 'media_content_full' => wp_attachment_is('image', $attachment->ID) ? wp_get_attachment_image( $attachment->ID, 'full', false) : (''),
+ 'media_title' => $attachment->post_title,
+ 'media_description' => $attachment->post_content,
+ 'media_caption' => $attachment->post_excerpt,
+ 'media_type' => $attachment->post_mime_type,
+ 'class_slide_metadata' => $class_slide_metadata
+ ));
+ }
+ }
+ if (
+ (tainacan_has_document() && $attachments && sizeof($attachments) > 0 ) ||
+ (!tainacan_has_document() && $attachments && sizeof($attachments) > 1 )
+ ) {
+ if ( tainacan_has_document() ) {
+ $is_document_type_attachment = tainacan_get_the_document_type() === 'attachment';
+ $media_items_thumbs[] =
+ tainacan_get_the_media_component_slide(array(
+ 'media_content' => get_the_post_thumbnail(null, 'tainacan-medium'),
+ 'media_content_full' => $is_document_type_attachment ? tainacan_get_the_document(0, 'full') : ('' . tainacan_get_the_document(0, 'full') . '
'),
+ 'media_title' => $is_document_type_attachment ? get_the_title(tainacan_get_the_document_raw()) : '',
+ 'media_description' => $is_document_type_attachment ? get_the_content(tainacan_get_the_document_raw()) : '',
+ 'media_caption' => $is_document_type_attachment ? get_the_excerpt(tainacan_get_the_document_raw()) : '',
+ 'media_type' => tainacan_get_the_document_type(),
+ 'class_slide_metadata' => 'hide-caption hide-description ' . ( get_theme_mod('tainacan_single_item_hide_files_name', false) ? 'hide-name' : '' )
+ ));
+
+ }
+ foreach ( $attachments as $attachment ) {
+ $media_items_thumbs[] =
+ tainacan_get_the_media_component_slide(array(
+ 'media_content' => wp_get_attachment_image( $attachment->ID, 'tainacan-medium', false ),
+ 'media_content_full' => wp_attachment_is('image', $attachment->ID) ? wp_get_attachment_image( $attachment->ID, 'full', false) : (''),
+ 'media_title' => $attachment->post_title,
+ 'media_description' => $attachment->post_content,
+ 'media_caption' => $attachment->post_excerpt,
+ 'media_type' => $attachment->post_mime_type,
+ 'class_slide_metadata' => 'hide-caption hide-description ' . ( get_theme_mod('tainacan_single_item_hide_files_name', false) ? 'hide-name' : '' )
+ ));
+ }
+ }
+ tainacan_the_media_component(
+ 'tainacan-item-attachments_id-' . $post->ID,
+ $media_items_thumbs,
+ $is_gallery_mode ? $media_items_main : null,
+ array(
+ 'class_main_div' => '',
+ 'class_thumbs_div' => '',
+ 'swiper_thumbs_options' => $is_gallery_mode ? '' : array(
+ 'navigation' => array(
+ 'nextEl' => '.swiper-navigation-next_' . 'tainacan-item-attachments_id-' . $post->ID . '-thumbs',
+ 'prevEl' => '.swiper-navigation-prev_' . 'tainacan-item-attachments_id-' . $post->ID . '-thumbs',
+ )
+ ),
+ 'swiper_main_options' => $is_gallery_mode ? array(
+ 'navigation' => array(
+ 'nextEl' => '.swiper-navigation-next_' . 'tainacan-item-attachments_id-' . $post->ID . '-main',
+ 'prevEl' => '.swiper-navigation-prev_' . 'tainacan-item-attachments_id-' . $post->ID . '-main',
+ )
+ ) : ''
+ )
+ );
+ ?>
+
+
+
+
+ $post->ID,
+ 'post_type' => 'attachment',
+ 'post_mime_type' => 'image',
+ 'order' => 'ASC',
+ 'numberposts' => -1,
+ )
+ )
+ );
+ }
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ' . tainacan_the_item_document_download_link() . '';
+ }
+ ?>
+
+
+
+
+
+
+ ID);
+ }
+ if ( !get_theme_mod( 'tainacan_single_item_hide_download_document', false ) && function_exists('tainacan_the_item_attachment_download_link') && tainacan_the_item_attachment_download_link($attachment->ID) != '' ) {
+ echo '' . tainacan_the_item_attachment_download_link($attachment->ID) . '';
+ }
+ ?>
+
+
+
+
+ 0 ) || (!tainacan_has_document() && $attachments && sizeof($attachments) > 1 ) ) : ?>
+
+
+
+ 'item-card--thumbnail mt-2'));
+ echo '
';
+ ?>
+
+
+
+
+
+
+ ID, 'tainacan-interface-item-attachments', true );
+ echo '
';
+ ?>
+ ID ); ?>
+
+
+
+
+
+
+
+
+ ID);
+ } else {
+ $href = wp_get_attachment_url($attachment->ID, 'large');
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/template-parts/single-items-metadata.php b/src/template-parts/single-items-metadata.php
index 1db2d88..4f07fcd 100644
--- a/src/template-parts/single-items-metadata.php
+++ b/src/template-parts/single-items-metadata.php
@@ -56,6 +56,7 @@
true,
'before_title' => '',
'after_title' => '
',
'before_value' => '
',