Adds new options to lightbox view.
This commit is contained in:
parent
3d69322f73
commit
993e20671b
|
@ -107,7 +107,7 @@ if ( !function_exists('tainacan_blocksy_gallery_light_color_scheme') ) {
|
||||||
|
|
||||||
$has_light_dark_color_scheme = get_theme_mod( $prefix . '_gallery_color_scheme', 'dark' ) == 'light';
|
$has_light_dark_color_scheme = get_theme_mod( $prefix . '_gallery_color_scheme', 'dark' ) == 'light';
|
||||||
|
|
||||||
if (!$has_light_dark_color_scheme)
|
if (!$has_light_dark_color_scheme || function_exists('tainacan_the_item_gallery'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$css = '
|
$css = '
|
||||||
|
|
|
@ -48,7 +48,27 @@ $options = [
|
||||||
blocksy_get_options(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/single-elements/hide-files-description-main.php', [
|
blocksy_get_options(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/single-elements/hide-files-description-main.php', [
|
||||||
'prefix' => $prefix,
|
'prefix' => $prefix,
|
||||||
'enabled' => 'yes'
|
'enabled' => 'yes'
|
||||||
], false)
|
], false),
|
||||||
|
blocksy_rand_md5() => [
|
||||||
|
'type' => 'ct-condition',
|
||||||
|
'condition' => [
|
||||||
|
$prefix . 'disable_gallery_lightbox' => 'no'
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
blocksy_get_options(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/single-elements/hide-files-caption-lightbox.php', [
|
||||||
|
'prefix' => $prefix,
|
||||||
|
'enabled' => 'no'
|
||||||
|
], false),
|
||||||
|
blocksy_get_options(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/single-elements/hide-files-name-lightbox.php', [
|
||||||
|
'prefix' => $prefix,
|
||||||
|
'enabled' => 'no'
|
||||||
|
], false),
|
||||||
|
blocksy_get_options(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/single-elements/hide-files-description-lightbox.php', [
|
||||||
|
'prefix' => $prefix,
|
||||||
|
'enabled' => 'no'
|
||||||
|
], false)
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -77,9 +97,17 @@ $options = [
|
||||||
blocksy_get_options(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/single-elements/attachments-typography.php', [
|
blocksy_get_options(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/single-elements/attachments-typography.php', [
|
||||||
'prefix' => $prefix
|
'prefix' => $prefix
|
||||||
], false),
|
], false),
|
||||||
blocksy_get_options(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/single-elements/gallery-color-scheme.php', [
|
blocksy_rand_md5() => [
|
||||||
'prefix' => $prefix
|
'type' => 'ct-condition',
|
||||||
], false)
|
'condition' => [
|
||||||
|
$prefix . 'disable_gallery_lightbox' => 'no'
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
blocksy_get_options(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/single-elements/gallery-color-scheme.php', [
|
||||||
|
'prefix' => $prefix
|
||||||
|
], false)
|
||||||
|
]
|
||||||
|
]
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (! isset($prefix)) {
|
||||||
|
$prefix = '';
|
||||||
|
}
|
||||||
|
if (! isset($enabled)) {
|
||||||
|
$enabled = 'no';}
|
||||||
|
|
||||||
|
$options = [
|
||||||
|
$prefix . 'hide_files_caption_lightbox' => [
|
||||||
|
'label' => __( 'Hide files caption', 'tainacan-blocksy' ),
|
||||||
|
'type' => 'ct-switch',
|
||||||
|
'value' => $enabled,
|
||||||
|
'setting' => [ 'transport' => 'postMessage' ],
|
||||||
|
'desc' => __( 'Toggle to hide the attachments and document caption on the lightbox.', 'tainacan-blocksy' ),
|
||||||
|
'sync' => blocksy_sync_single_post_container([
|
||||||
|
'prefix' => $prefix,
|
||||||
|
]),
|
||||||
|
]
|
||||||
|
];
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (! isset($prefix)) {
|
||||||
|
$prefix = '';
|
||||||
|
}
|
||||||
|
if (! isset($enabled)) {
|
||||||
|
$enabled = 'no';
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = [
|
||||||
|
$prefix . 'hide_files_description_lightbox' => [
|
||||||
|
'label' => __( 'Hide files description', 'tainacan-blocksy' ),
|
||||||
|
'type' => 'ct-switch',
|
||||||
|
'value' => $enabled,
|
||||||
|
'setting' => [ 'transport' => 'postMessage' ],
|
||||||
|
'desc' => __( 'Toggle to hide the attachments and document description on the lightbox.', 'tainacan-blocksy' ),
|
||||||
|
'sync' => blocksy_sync_single_post_container([
|
||||||
|
'prefix' => $prefix,
|
||||||
|
]),
|
||||||
|
]
|
||||||
|
];
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (! isset($prefix)) {
|
||||||
|
$prefix = '';
|
||||||
|
}
|
||||||
|
if (! isset($enabled)) {
|
||||||
|
$enabled = 'no';
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = [
|
||||||
|
$prefix . 'hide_files_name_lightbox' => [
|
||||||
|
'label' => __( 'Hide files name', 'tainacan-blocksy' ),
|
||||||
|
'type' => 'ct-switch',
|
||||||
|
'value' => $enabled,
|
||||||
|
'setting' => [ 'transport' => 'postMessage' ],
|
||||||
|
'desc' => __( 'Toggle to hide the attachments and document name on the lightbox view.', 'tainacan-blocksy' ),
|
||||||
|
'sync' => blocksy_sync_single_post_container([
|
||||||
|
'prefix' => $prefix,
|
||||||
|
]),
|
||||||
|
]
|
||||||
|
];
|
|
@ -1,135 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
$attachments = tainacan_get_the_attachments();
|
if ( function_exists('tainacan_the_item_gallery') ) { //if (version_compare(TAINACAN_VERSION, '0.19RC') >= 0) {
|
||||||
$prefix = blocksy_manager()->screen->get_prefix();
|
tainacan_blocksy_get_template_part( 'template-parts/tainacan-item-single-attachments_new' );
|
||||||
|
} else if ( function_exists('tainacan_get_the_media_component') ) { //if (version_compare(TAINACAN_VERSION, '0.18RC') >= 0) {
|
||||||
// Galley mode is a shortname for when documents and attachments are displayed merged in the same list
|
tainacan_blocksy_get_template_part( 'template-parts/tainacan-item-single-attachments_old' );
|
||||||
$is_gallery_mode = get_theme_mod( $prefix . '_document_attachments_structure', 'gallery-type-1' ) == 'gallery-type-2';
|
} else {
|
||||||
$hide_file_name = get_theme_mod( $prefix . '_hide_files_name', 'no') == 'yes';
|
?>
|
||||||
$hide_file_name_main = get_theme_mod( $prefix . '_hide_files_name_main', 'yes') == 'yes';
|
<div style="text-aling: center; max-width: 600px; margin: 2em auto; width: 100%; font-style: italic;">
|
||||||
$hide_file_caption_main = get_theme_mod( $prefix . '_hide_files_caption_main', 'yes') == 'yes';
|
<p><?php __('It seems that you are using a legacy vesion of the Tainacan plugin. Please update in order to use the latest features for displaying item media.', 'tainacan-blocksy') ?></p>
|
||||||
$hide_file_description_main = get_theme_mod( $prefix . '_hide_files_description_main', 'yes') == 'yes';
|
</div>
|
||||||
$hide_download_button = get_theme_mod( $prefix . '_hide_download_button', 'no' ) == 'yes';
|
<?php
|
||||||
$disable_gallery_lightbox = get_theme_mod( $prefix . '_disable_gallery_lightbox', 'no') == 'yes';
|
}
|
||||||
|
?>
|
||||||
global $post;
|
|
||||||
|
|
||||||
if ( function_exists('tainacan_the_media_component') && ( !empty( $attachments ) || ( $is_gallery_mode && tainacan_has_document() ) ) ) {
|
|
||||||
?>
|
|
||||||
<section class="tainacan-item-section tainacan-item-section--<?php echo ((!$is_gallery_mode ? 'attachments' : 'gallery')) ?>">
|
|
||||||
<?php if ( (get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes') && (!$is_gallery_mode) && get_theme_mod($prefix . '_section_attachments_label', __( 'Attachments', 'tainacan-blocksy' )) != '' ) : ?>
|
|
||||||
<h2 class="tainacan-single-item-section" id="tainacan-item-attachments-label">
|
|
||||||
<?php echo esc_html( get_theme_mod($prefix . '_section_attachments_label', __( 'Attachments', 'tainacan-blocksy' ) ) ); ?>
|
|
||||||
</h2>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ( (get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes') && ($is_gallery_mode) && get_theme_mod($prefix . '_section_documents_label', __( 'Documents', 'tainacan-blocksy' )) != '') : ?>
|
|
||||||
<h2 class="tainacan-single-item-section" id="tainacan-item-documents-label">
|
|
||||||
<?php echo esc_html( get_theme_mod($prefix . '_section_documents_label', __( 'Documents', 'tainacan-blocksy' )) ); ?>
|
|
||||||
</h2>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$media_items_thumbs = array();
|
|
||||||
$media_items_main = array();
|
|
||||||
|
|
||||||
if ($is_gallery_mode) {
|
|
||||||
|
|
||||||
$class_slide_metadata = '';
|
|
||||||
if ($hide_file_name_main)
|
|
||||||
$class_slide_metadata .= ' hide-name';
|
|
||||||
if ($hide_file_description_main)
|
|
||||||
$class_slide_metadata .= ' hide-description';
|
|
||||||
if ($hide_file_caption_main)
|
|
||||||
$class_slide_metadata .= ' hide-caption';
|
|
||||||
|
|
||||||
if ( tainacan_has_document() ) {
|
|
||||||
$is_document_type_attachment = tainacan_get_the_document_type() === 'attachment';
|
|
||||||
|
|
||||||
$media_items_main[] =
|
|
||||||
tainacan_get_the_media_component_slide(array(
|
|
||||||
'after_slide_metadata' => (( !$hide_download_button && tainacan_the_item_document_download_link() != '' ) ?
|
|
||||||
('<span class="tainacan-item-file-download">' . tainacan_the_item_document_download_link() . '</span>')
|
|
||||||
: ''),
|
|
||||||
'media_content' => tainacan_get_the_document(),
|
|
||||||
'media_content_full' => $is_document_type_attachment ? tainacan_get_the_document(0, 'full') : ('<div class="attachment-without-image">' . tainacan_get_the_document(0, 'full') . '</div>'),
|
|
||||||
'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' => (( !$hide_download_button && tainacan_the_item_attachment_download_link($attachment->ID) != '' ) ?
|
|
||||||
'<span class="tainacan-item-file-download">' . tainacan_the_item_attachment_download_link($attachment->ID) . '</span>'
|
|
||||||
: ''),
|
|
||||||
'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) : ('<div class="attachment-without-image tainacan-embed-container"><iframe id="tainacan-attachment-iframe" src="' . tainacan_get_attachment_html_url($attachment->ID) . '"></iframe></div>'),
|
|
||||||
'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') : ('<div class="attachment-without-image">' . tainacan_get_the_document(0, 'full') . '</div>'),
|
|
||||||
'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_file_name ? '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) : ('<div class="attachment-without-image tainacan-embed-container"><iframe id="tainacan-attachment-iframe" src="' . tainacan_get_attachment_html_url($attachment->ID) . '"></iframe></div>'),
|
|
||||||
'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_file_name ? 'hide-name' : '' )
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tainacan_the_media_component(
|
|
||||||
'tainacan-item-attachments_id-' . $post->ID,
|
|
||||||
$media_items_thumbs,
|
|
||||||
$is_gallery_mode ? $media_items_main : null,
|
|
||||||
array(
|
|
||||||
'class_thumbs_li' => 'tainacan-item-section__attachments-file',
|
|
||||||
'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',
|
|
||||||
)
|
|
||||||
) : '',
|
|
||||||
'disable_lightbox' => $is_gallery_mode ? $disable_gallery_lightbox : false,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
</section>
|
|
||||||
<?php } ?>
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
$attachments = tainacan_get_the_attachments();
|
||||||
|
$prefix = blocksy_manager()->screen->get_prefix();
|
||||||
|
|
||||||
|
// Galley mode is a shortname for when documents and attachments are displayed merged in the same list
|
||||||
|
$is_gallery_mode = get_theme_mod( $prefix . '_document_attachments_structure', 'gallery-type-1' ) == 'gallery-type-2';
|
||||||
|
$hide_file_name = get_theme_mod( $prefix . '_hide_files_name', 'no') == 'yes';
|
||||||
|
$hide_file_name_main = get_theme_mod( $prefix . '_hide_files_name_main', 'yes') == 'yes';
|
||||||
|
$hide_file_caption_main = get_theme_mod( $prefix . '_hide_files_caption_main', 'yes') == 'yes';
|
||||||
|
$hide_file_description_main = get_theme_mod( $prefix . '_hide_files_description_main', 'yes') == 'yes';
|
||||||
|
$hide_download_button = get_theme_mod( $prefix . '_hide_download_button', 'no' ) == 'yes';
|
||||||
|
$disable_gallery_lightbox = get_theme_mod( $prefix . '_disable_gallery_lightbox', 'no') == 'yes';
|
||||||
|
$hide_file_name_lightbox = get_theme_mod( $prefix . '_hide_files_name_lightbox', 'no') == 'yes';
|
||||||
|
$hide_file_caption_lightbox = get_theme_mod( $prefix . '_hide_files_caption_lightbox', 'no') == 'yes';
|
||||||
|
$hide_file_description_lightbox = get_theme_mod( $prefix . '_hide_files_description_lightbox', 'no') == 'yes';
|
||||||
|
$has_light_dark_color_scheme = get_theme_mod( $prefix . '_gallery_color_scheme', 'dark' ) == 'light';
|
||||||
|
|
||||||
|
global $post;
|
||||||
|
|
||||||
|
if ( function_exists('tainacan_the_media_component') && ( !empty( $attachments ) || ( $is_gallery_mode && tainacan_has_document() ) ) ) {
|
||||||
|
?>
|
||||||
|
<section class="tainacan-item-section tainacan-item-section--<?php echo ((!$is_gallery_mode ? 'attachments' : 'gallery')) ?>">
|
||||||
|
<?php if ( (get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes') && (!$is_gallery_mode) && get_theme_mod($prefix . '_section_attachments_label', __( 'Attachments', 'tainacan-blocksy' )) != '' ) : ?>
|
||||||
|
<h2 class="tainacan-single-item-section" id="tainacan-item-attachments-label">
|
||||||
|
<?php echo esc_html( get_theme_mod($prefix . '_section_attachments_label', __( 'Attachments', 'tainacan-blocksy' ) ) ); ?>
|
||||||
|
</h2>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( (get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes') && ($is_gallery_mode) && get_theme_mod($prefix . '_section_documents_label', __( 'Documents', 'tainacan-blocksy' )) != '') : ?>
|
||||||
|
<h2 class="tainacan-single-item-section" id="tainacan-item-documents-label">
|
||||||
|
<?php echo esc_html( get_theme_mod($prefix . '_section_documents_label', __( 'Documents', 'tainacan-blocksy' )) ); ?>
|
||||||
|
</h2>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
tainacan_the_item_gallery([
|
||||||
|
'blockId' => '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_main,
|
||||||
|
'hideFileCaptionMain' => $hide_file_caption_main,
|
||||||
|
'hideFileDescriptionMain' => $hide_file_description_main,
|
||||||
|
'hideFileNameThumbnails' => $hide_file_name,
|
||||||
|
'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
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
</section>
|
||||||
|
<?php } ?>
|
|
@ -0,0 +1,135 @@
|
||||||
|
<?php
|
||||||
|
$attachments = tainacan_get_the_attachments();
|
||||||
|
$prefix = blocksy_manager()->screen->get_prefix();
|
||||||
|
|
||||||
|
// Galley mode is a shortname for when documents and attachments are displayed merged in the same list
|
||||||
|
$is_gallery_mode = get_theme_mod( $prefix . '_document_attachments_structure', 'gallery-type-1' ) == 'gallery-type-2';
|
||||||
|
$hide_file_name = get_theme_mod( $prefix . '_hide_files_name', 'no') == 'yes';
|
||||||
|
$hide_file_name_main = get_theme_mod( $prefix . '_hide_files_name_main', 'yes') == 'yes';
|
||||||
|
$hide_file_caption_main = get_theme_mod( $prefix . '_hide_files_caption_main', 'yes') == 'yes';
|
||||||
|
$hide_file_description_main = get_theme_mod( $prefix . '_hide_files_description_main', 'yes') == 'yes';
|
||||||
|
$hide_download_button = get_theme_mod( $prefix . '_hide_download_button', 'no' ) == 'yes';
|
||||||
|
$disable_gallery_lightbox = get_theme_mod( $prefix . '_disable_gallery_lightbox', 'no') == 'yes';
|
||||||
|
|
||||||
|
global $post;
|
||||||
|
|
||||||
|
if ( function_exists('tainacan_the_media_component') && ( !empty( $attachments ) || ( $is_gallery_mode && tainacan_has_document() ) ) ) {
|
||||||
|
?>
|
||||||
|
<section class="tainacan-item-section tainacan-item-section--<?php echo ((!$is_gallery_mode ? 'attachments' : 'gallery')) ?>">
|
||||||
|
<?php if ( (get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes') && (!$is_gallery_mode) && get_theme_mod($prefix . '_section_attachments_label', __( 'Attachments', 'tainacan-blocksy' )) != '' ) : ?>
|
||||||
|
<h2 class="tainacan-single-item-section" id="tainacan-item-attachments-label">
|
||||||
|
<?php echo esc_html( get_theme_mod($prefix . '_section_attachments_label', __( 'Attachments', 'tainacan-blocksy' ) ) ); ?>
|
||||||
|
</h2>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( (get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes') && ($is_gallery_mode) && get_theme_mod($prefix . '_section_documents_label', __( 'Documents', 'tainacan-blocksy' )) != '') : ?>
|
||||||
|
<h2 class="tainacan-single-item-section" id="tainacan-item-documents-label">
|
||||||
|
<?php echo esc_html( get_theme_mod($prefix . '_section_documents_label', __( 'Documents', 'tainacan-blocksy' )) ); ?>
|
||||||
|
</h2>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$media_items_thumbs = array();
|
||||||
|
$media_items_main = array();
|
||||||
|
|
||||||
|
if ($is_gallery_mode) {
|
||||||
|
|
||||||
|
$class_slide_metadata = '';
|
||||||
|
if ($hide_file_name_main)
|
||||||
|
$class_slide_metadata .= ' hide-name';
|
||||||
|
if ($hide_file_description_main)
|
||||||
|
$class_slide_metadata .= ' hide-description';
|
||||||
|
if ($hide_file_caption_main)
|
||||||
|
$class_slide_metadata .= ' hide-caption';
|
||||||
|
|
||||||
|
if ( tainacan_has_document() ) {
|
||||||
|
$is_document_type_attachment = tainacan_get_the_document_type() === 'attachment';
|
||||||
|
|
||||||
|
$media_items_main[] =
|
||||||
|
tainacan_get_the_media_component_slide(array(
|
||||||
|
'after_slide_metadata' => (( !$hide_download_button && tainacan_the_item_document_download_link() != '' ) ?
|
||||||
|
('<span class="tainacan-item-file-download">' . tainacan_the_item_document_download_link() . '</span>')
|
||||||
|
: ''),
|
||||||
|
'media_content' => tainacan_get_the_document(),
|
||||||
|
'media_content_full' => $is_document_type_attachment ? tainacan_get_the_document(0, 'full') : ('<div class="attachment-without-image">' . tainacan_get_the_document(0, 'full') . '</div>'),
|
||||||
|
'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' => (( !$hide_download_button && tainacan_the_item_attachment_download_link($attachment->ID) != '' ) ?
|
||||||
|
'<span class="tainacan-item-file-download">' . tainacan_the_item_attachment_download_link($attachment->ID) . '</span>'
|
||||||
|
: ''),
|
||||||
|
'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) : ('<div class="attachment-without-image tainacan-embed-container"><iframe id="tainacan-attachment-iframe" src="' . tainacan_get_attachment_html_url($attachment->ID) . '"></iframe></div>'),
|
||||||
|
'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') : ('<div class="attachment-without-image">' . tainacan_get_the_document(0, 'full') . '</div>'),
|
||||||
|
'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_file_name ? '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) : ('<div class="attachment-without-image tainacan-embed-container"><iframe id="tainacan-attachment-iframe" src="' . tainacan_get_attachment_html_url($attachment->ID) . '"></iframe></div>'),
|
||||||
|
'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_file_name ? 'hide-name' : '' )
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tainacan_the_media_component(
|
||||||
|
'tainacan-item-attachments_id-' . $post->ID,
|
||||||
|
$media_items_thumbs,
|
||||||
|
$is_gallery_mode ? $media_items_main : null,
|
||||||
|
array(
|
||||||
|
'class_thumbs_li' => 'tainacan-item-section__attachments-file',
|
||||||
|
'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',
|
||||||
|
)
|
||||||
|
) : '',
|
||||||
|
'disable_lightbox' => $is_gallery_mode ? $disable_gallery_lightbox : false,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</section>
|
||||||
|
<?php } ?>
|
Loading…
Reference in New Issue