diff --git a/src/functions/customizer/tainacan-single-item-page-document.php b/src/functions/customizer/tainacan-single-item-page-document.php
index 24ddaa9..c270edf 100644
--- a/src/functions/customizer/tainacan-single-item-page-document.php
+++ b/src/functions/customizer/tainacan-single-item-page-document.php
@@ -287,6 +287,63 @@ if ( !function_exists('tainacan_interface_customize_register_tainacan_single_ite
),
) );
}
+
+ if ( function_exists('tainacan_the_item_gallery') ) {
+
+ /**
+ * Adds options to hide attachments file names on the lightbox.
+ */
+ $wp_customize->add_setting( 'tainacan_single_item_hide_files_name_lightbox', array(
+ 'type' => 'theme_mod',
+ 'capability' => 'edit_theme_options',
+ 'default' => false,
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'tainacan_callback_sanitize_checkbox'
+ ) );
+ $wp_customize->add_control( 'tainacan_single_item_hide_files_name_lightbox', array(
+ 'type' => 'checkbox',
+ 'priority' => 4, // Within the section.
+ 'section' => 'tainacan_single_item_page_document',
+ 'label' => __( 'Hide the attachments label (in the lightbox)', 'tainacan-interface' ),
+ 'description' => __( 'Toggle to not display the document and attachments name in the lightbox.', 'tainacan-interface' )
+ ) );
+
+ /**
+ * Adds options to hide attachments file caption on the lightbox.
+ */
+ $wp_customize->add_setting( 'tainacan_single_item_hide_files_caption_lightbox', array(
+ 'type' => 'theme_mod',
+ 'capability' => 'edit_theme_options',
+ 'default' => false,
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'tainacan_callback_sanitize_checkbox'
+ ) );
+ $wp_customize->add_control( 'tainacan_single_item_hide_files_caption_lightbox', array(
+ 'type' => 'checkbox',
+ 'priority' => 4, // Within the section.
+ 'section' => 'tainacan_single_item_page_document',
+ 'label' => __( 'Hide the attachments caption (in the lightbox)', 'tainacan-interface' ),
+ 'description' => __( 'Toggle to not display the document and attachments caption in the lightbox.', 'tainacan-interface' )
+ ) );
+
+ /**
+ * Adds options to hide attachments file description on the lightbox.
+ */
+ $wp_customize->add_setting( 'tainacan_single_item_hide_files_description_lightbox', array(
+ 'type' => 'theme_mod',
+ 'capability' => 'edit_theme_options',
+ 'default' => false,
+ 'transport' => 'refresh',
+ 'sanitize_callback' => 'tainacan_callback_sanitize_checkbox'
+ ) );
+ $wp_customize->add_control( 'tainacan_single_item_hide_files_description_lightbox', array(
+ 'type' => 'checkbox',
+ 'priority' => 4, // Within the section.
+ 'section' => 'tainacan_single_item_page_document',
+ 'label' => __( 'Hide the attachments description (in the lightbox)', 'tainacan-interface' ),
+ 'description' => __( 'Toggle to not display the document and attachments description in the lightbox.', 'tainacan-interface' )
+ ) );
+ }
}
}
add_action( 'customize_register', 'tainacan_interface_customize_register_tainacan_single_item_page_document', 11 );
@@ -408,7 +465,7 @@ if ( !function_exists('tainacan_gallery_light_color_scheme') ) {
$has_light_dark_color_scheme = get_theme_mod( 'tainacan_single_item_gallery_color_scheme', 'dark' ) == 'light';
- if (!$has_light_dark_color_scheme)
+ if (!$has_light_dark_color_scheme || function_exists('tainacan_the_item_gallery'))
return;
$css = '
diff --git a/src/template-parts/single-items-attachments.php b/src/template-parts/single-items-attachments.php
index 45212ce..3546d72 100644
--- a/src/template-parts/single-items-attachments.php
+++ b/src/template-parts/single-items-attachments.php
@@ -1,7 +1,13 @@
= 0) {
+ if ( function_exists('tainacan_the_item_gallery') ) { //if (version_compare(TAINACAN_VERSION, '0.19RC') >= 0) {
get_template_part( 'template-parts/single-items-attachments_new' );
- } else {
+ } else if ( function_exists('tainacan_get_the_media_component') ) { //if (version_compare(TAINACAN_VERSION, '0.18RC') >= 0) {
get_template_part( 'template-parts/single-items-attachments_old' );
+ } else {
+ ?>
+
+
\ 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
index ef0b7b3..5a5f357 100644
--- a/src/template-parts/single-items-attachments_new.php
+++ b/src/template-parts/single-items-attachments_new.php
@@ -1,13 +1,18 @@
@@ -21,116 +26,32 @@ if ( !empty( $attachments ) || ( get_theme_mod( 'tainacan_single_item_gallery_m
+
- (( !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 ? wp_get_attachment_caption(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 ? wp_get_attachment_caption(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',
- 'preloadImages' => false,
- 'lazy' => true
- )
- ),
- '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',
- 'preloadImages' => false,
- 'lazy' => true
- )
- ) : '',
- 'disable_lightbox' => $is_gallery_mode ? $disable_gallery_lightbox : false,
- )
- );
+ 'tainacan-item-attachments_id-' . $post->ID,
+ 'layoutElements' => array( 'main' => $is_gallery_mode, 'thumbnails' => true ),
+ 'mediaSources' => array( 'document' => $is_gallery_mode, 'attachments' => true, 'metadata' => false),
+ 'hideFileNameMain' => $hide_file_name,
+ 'hideFileCaptionMain' => $hide_file_caption,
+ 'hideFileDescriptionMain' => $hide_file_description,
+ 'hideFileNameThumbnails' => $hide_thumbnail_info,
+ 'hideFileCaptionThumbnails' => true,
+ 'hideFileDescriptionThumbnails' => true,
+ 'showDownloadButtonMain' => !$hide_download_button,
+ 'showArrowsAsSVG' => false,
+ 'hideFileNameLightbox' => $hide_file_name_lightbox,
+ 'hideFileCaptionLightbox' => $hide_file_caption_lightbox,
+ 'hideFileDescriptionLightbox' => $hide_file_description_lightbox,
+ 'openLightboxOnClick' => $is_gallery_mode ? !$disable_gallery_lightbox : true,
+ 'lightboxHasLightBackground' => $has_light_dark_color_scheme
+ ]);
?>
+
diff --git a/src/template-parts/single-items-attachments_old.php b/src/template-parts/single-items-attachments_old.php
index b99e6e4..597aada 100644
--- a/src/template-parts/single-items-attachments_old.php
+++ b/src/template-parts/single-items-attachments_old.php
@@ -1,119 +1,141 @@
$post->ID,
- 'post_type' => 'attachment',
- 'post_mime_type' => 'image',
- 'order' => 'ASC',
- 'numberposts' => -1,
- )
- )
- );
- }
+
+$attachments = tainacan_get_the_attachments();
+$is_gallery_mode = get_theme_mod( 'tainacan_single_item_gallery_mode', false );
+$hide_file_name = get_theme_mod('tainacan_single_item_hide_files_name_main', true);
+$hide_file_caption = get_theme_mod('tainacan_single_item_hide_files_caption_main', true);
+$hide_file_description = get_theme_mod('tainacan_single_item_hide_files_description_main', true);
+$disable_gallery_lightbox = get_theme_mod('tainacan_single_item_disable_gallery_lightbox', false);
+$hide_thumbnail_info = get_theme_mod('tainacan_single_item_hide_files_name', false);
+
+if ( !empty( $attachments ) || ( get_theme_mod( 'tainacan_single_item_gallery_mode', false) && tainacan_has_document() ) ) {
?>
-
-
-
+
-
+
-
-
-
-
-
-
- ' . 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-medium', true );
- echo '
';
- ?>
- ID ); ?>
-
-
-
-
-
-
-
-
- ID);
- } else {
- $href = wp_get_attachment_url($attachment->ID, 'large');
- }
- ?>
-
-
-
-
+
+
+ (( !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 ? wp_get_attachment_caption(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 ? wp_get_attachment_caption(tainacan_get_the_document_raw()) : '',
+ 'media_type' => tainacan_get_the_document_type(),
+ 'class_slide_metadata' => 'hide-caption hide-description ' . ( $hide_thumbnail_info ? '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 ' . ( $hide_thumbnail_info ? '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',
+ 'preloadImages' => false,
+ 'lazy' => true
+ )
+ ),
+ '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',
+ 'preloadImages' => false,
+ 'lazy' => true
+ )
+ ) : '',
+ 'disable_lightbox' => $is_gallery_mode ? $disable_gallery_lightbox : false,
+ )
+ );
+ ?>
+
-
-
\ No newline at end of file
+= 0) {
$hide_file_name = get_theme_mod('tainacan_single_item_hide_files_name_main', true);
$hide_file_caption = get_theme_mod('tainacan_single_item_hide_files_caption_main', true);
$hide_file_description = get_theme_mod('tainacan_single_item_hide_files_description_main', true);
+ $hide_thumbnail_info = get_theme_mod('tainacan_single_item_hide_files_name', false);
$is_document_type_attachment = tainacan_get_the_document_type() === 'attachment';
$disable_gallery_lightbox = get_theme_mod('tainacan_single_item_disable_gallery_lightbox', false);
+ $hide_download_button = get_theme_mod( 'tainacan_single_item_hide_download_document', false );
+ $has_light_dark_color_scheme = get_theme_mod( 'tainacan_single_item_gallery_color_scheme', 'dark' ) == 'light';
- $class_slide_metadata = '';
-
- if ($hide_file_name)
- $class_slide_metadata .= ' hide-name';
- if ($hide_file_description)
- $class_slide_metadata .= ' hide-description';
- if ($hide_file_caption)
- $class_slide_metadata .= ' hide-caption';
-
+ if ( function_exists('tainacan_the_item_gallery') ) {
+ $hide_file_name_lightbox = get_theme_mod('tainacan_single_item_hide_files_name_lightbox', false);
+ $hide_file_caption_lightbox = get_theme_mod('tainacan_single_item_hide_files_caption_lightbox', false);
+ $hide_file_description_lightbox = get_theme_mod('tainacan_single_item_hide_files_description_lightbox', false);
+ }
global $post;
}
@@ -28,37 +27,28 @@ if ( tainacan_has_document() && !get_theme_mod( 'tainacan_single_item_gallery_mo
- ' . tainacan_the_item_document_download_link() . '';
-
- if ( version_compare(TAINACAN_VERSION, '0.18RC') >= 0 ) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 'tainacan-item-document_id-' . $post->ID,
+ 'layoutElements' => array( 'main' => true, 'thumbnails' => false ),
+ 'mediaSources' => array( 'document' => true, 'attachments' => false, 'metadata' => false),
+ 'hideFileNameMain' => $hide_file_name,
+ 'hideFileCaptionMain' => $hide_file_caption,
+ 'hideFileDescriptionMain' => $hide_file_description,
+ 'hideFileNameThumbnails' => $hide_thumbnail_info,
+ 'hideFileCaptionThumbnails' => true,
+ 'hideFileDescriptionThumbnails' => true,
+ 'showDownloadButtonMain' => !$hide_download_button,
+ 'showArrowsAsSVG' => false,
+ 'hideFileNameLightbox' => $hide_file_name_lightbox,
+ 'hideFileCaptionLightbox' => $hide_file_caption_lightbox,
+ 'hideFileDescriptionLightbox' => $hide_file_description_lightbox,
+ 'openLightboxOnClick' => !$disable_gallery_lightbox,
+ 'lightboxHasLightBackground' => $has_light_dark_color_scheme
+ ]);
- } else {
+ } else if (function_exists('tainacan_get_the_media_component')) {
$media_items_main = array();
$class_slide_metadata = '';
@@ -73,7 +63,7 @@ if ( tainacan_has_document() && !get_theme_mod( 'tainacan_single_item_gallery_mo
$is_document_type_attachment = tainacan_get_the_document_type() === '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_document_download_link() != '' ) ?
+ 'after_slide_metadata' => (( !$hide_download_button && tainacan_the_item_document_download_link() != '' ) ?
('
' . tainacan_the_item_document_download_link() . '')
: ''),
'media_content' => tainacan_get_the_document(),
@@ -106,6 +96,12 @@ if ( tainacan_has_document() && !get_theme_mod( 'tainacan_single_item_gallery_mo
)
);
+ } else {
+ ?>
+
+