New media gallery for attachments
This commit is contained in:
parent
915851057d
commit
803031de4d
|
@ -732,11 +732,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.single-item-collection--attachments-file {
|
.single-item-collection--attachments-file,
|
||||||
|
.tainacan-media-component__swiper-main .swiper-slide {
|
||||||
&:hover {
|
&:hover {
|
||||||
.tainacan-item-file-download {
|
.tainacan-item-file-download {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: scale(1);
|
transform: scale(1);
|
||||||
|
a { background-color: transparent; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -794,7 +796,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.single-item-collection--information{
|
.single-item-collection--information{
|
||||||
.card{
|
.card {
|
||||||
|
background-color: transparent;
|
||||||
|
box-shadow: none;
|
||||||
.item-card--thumbnail{
|
.item-card--thumbnail{
|
||||||
height: auto;
|
height: auto;
|
||||||
max-width: 250px;
|
max-width: 250px;
|
||||||
|
|
|
@ -662,10 +662,66 @@ function tainacan_customize_register( $wp_customize ) {
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'priority' => 3, // Within the section.
|
'priority' => 3, // Within the section.
|
||||||
'section' => 'tainacan_single_item_page',
|
'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' )
|
'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.
|
* Adds options to display item author and publish date.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,119 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
if (function_exists('tainacan_get_the_attachments')) {
|
if ( function_exists('tainacan_get_the_media_component') ) { //if (version_compare(TAINACAN_VERSION, '0.18RC') >= 0) {
|
||||||
$attachments = tainacan_get_the_attachments();
|
get_template_part( 'template-parts/single-items-attachments_new' );
|
||||||
} else {
|
} else {
|
||||||
// compatibility with pre 0.11 tainacan plugin
|
get_template_part( 'template-parts/single-items-attachments_old' );
|
||||||
$attachments = array_values(
|
|
||||||
get_children(
|
|
||||||
array(
|
|
||||||
'post_parent' => $post->ID,
|
|
||||||
'post_type' => 'attachment',
|
|
||||||
'post_mime_type' => 'image',
|
|
||||||
'order' => 'ASC',
|
|
||||||
'numberposts' => -1,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ( !empty( $attachments ) || ( get_theme_mod( 'tainacan_single_item_gallery_mode', false) && tainacan_has_document() )) : ?>
|
|
||||||
|
|
||||||
<div class="mt-3 tainacan-single-post">
|
|
||||||
<?php if ( !get_theme_mod( 'tainacan_single_item_gallery_mode', false ) && get_theme_mod('tainacan_single_item_attachments_section_label', __( 'Attachments', 'tainacan-interface' )) != '') : ?>
|
|
||||||
<h2 class="title-content-items" id="single-item-attachments-label">
|
|
||||||
<?php echo esc_html( get_theme_mod('tainacan_single_item_attachments_section_label', __( 'Attachments', 'tainacan-interface' )) ); ?>
|
|
||||||
</h2>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ( get_theme_mod( 'tainacan_single_item_gallery_mode', false ) && get_theme_mod('tainacan_single_item_documents_section_label', __( 'Documents', 'tainacan-interface' )) != '') : ?>
|
|
||||||
<h2 class="title-content-items" id="single-item-documents-label">
|
|
||||||
<?php echo esc_html( get_theme_mod('tainacan_single_item_documents_section_label', __( 'Documents', 'tainacan-interface' )) ); ?>
|
|
||||||
</h2>
|
|
||||||
<?php endif; ?>
|
|
||||||
<section class="tainacan-content single-item-collection margin-two-column">
|
|
||||||
<?php if (get_theme_mod( 'tainacan_single_item_gallery_mode', false )): ?>
|
|
||||||
<div class="single-item-collection--gallery">
|
|
||||||
<?php if ( tainacan_has_document() ) : ?>
|
|
||||||
<section class="tainacan-content single-item-collection margin-two-column">
|
|
||||||
<div class="single-item-collection--document">
|
|
||||||
<?php
|
|
||||||
tainacan_the_document();
|
|
||||||
if ( !get_theme_mod( 'tainacan_single_item_hide_download_document', false ) && function_exists('tainacan_the_item_document_download_link') && tainacan_the_item_document_download_link() != '' ) {
|
|
||||||
echo '<span class="tainacan-item-file-download">' . tainacan_the_item_document_download_link() . '</span>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php foreach ( $attachments as $attachment ) { ?>
|
|
||||||
<section class="tainacan-content single-item-collection margin-two-column">
|
|
||||||
<div class="single-item-collection--document">
|
|
||||||
<?php
|
|
||||||
if ( function_exists('tainacan_get_single_attachment_as_html') ) {
|
|
||||||
tainacan_get_single_attachment_as_html($attachment->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 '<span class="tainacan-item-file-download">' . tainacan_the_item_attachment_download_link($attachment->ID) . '</span>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
<?php if ( (tainacan_has_document() && $attachments && sizeof($attachments) > 0 ) || (!tainacan_has_document() && $attachments && sizeof($attachments) > 1 ) ) : ?>
|
|
||||||
<div class="single-item-collection--gallery-items">
|
|
||||||
<?php if ( tainacan_has_document() ) : ?>
|
|
||||||
<div class="single-item-collection--attachments-file">
|
|
||||||
<?php
|
|
||||||
the_post_thumbnail('tainacan-medium-full', array('class' => 'item-card--thumbnail mt-2'));
|
|
||||||
echo '<br>';
|
|
||||||
?>
|
|
||||||
<span class="single-item-file-name <?php if (get_theme_mod('tainacan_single_item_hide_files_name', false)) echo 'sr-only' ?>"><?php echo __( 'Document', 'tainacan-interface' ); ?></span>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php foreach ( $attachments as $attachment ) { ?>
|
|
||||||
<div class="single-item-collection--attachments-file">
|
|
||||||
<div class="<?php if (!wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments')) echo'attachment-without-image'; ?>">
|
|
||||||
<?php
|
|
||||||
echo wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments', true );
|
|
||||||
echo '<br>';
|
|
||||||
?>
|
|
||||||
<span class="single-item-file-name <?php if (get_theme_mod('tainacan_single_item_hide_files_name', false)) echo 'sr-only' ?>"><?php echo get_the_title( $attachment->ID ); ?></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php else : ?>
|
|
||||||
<div class="single-item-collection--attachments">
|
|
||||||
<?php foreach ( $attachments as $attachment ) { ?>
|
|
||||||
<?php
|
|
||||||
if ( function_exists('tainacan_get_attachment_html_url') ) {
|
|
||||||
$href = tainacan_get_attachment_html_url($attachment->ID);
|
|
||||||
} else {
|
|
||||||
$href = wp_get_attachment_url($attachment->ID, 'large');
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<div class="single-item-collection--attachments-file">
|
|
||||||
<a
|
|
||||||
class="<?php if (!wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments')) echo'attachment-without-image'; ?>"
|
|
||||||
href="<?php echo $href; ?>"
|
|
||||||
data-toggle="lightbox"
|
|
||||||
data-gallery="example-gallery">
|
|
||||||
<?php
|
|
||||||
echo wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments', true );
|
|
||||||
echo '<br>';
|
|
||||||
?>
|
|
||||||
<span class="single-item-file-name <?php if (get_theme_mod('tainacan_single_item_hide_files_name', false)) echo 'sr-only' ?>"><?php echo get_the_title( $attachment->ID ); ?></span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<?php }
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="my-5 border-bottom border-silver"></div>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
|
|
@ -0,0 +1,130 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$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);
|
||||||
|
|
||||||
|
if ( !empty( $attachments ) || ( get_theme_mod( 'tainacan_single_item_gallery_mode', false) && tainacan_has_document() ) ) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="mt-3 tainacan-single-post">
|
||||||
|
<?php if ( !$is_gallery_mode && get_theme_mod('tainacan_single_item_attachments_section_label', __( 'Attachments', 'tainacan-interface' )) != '') : ?>
|
||||||
|
<h2 class="title-content-items" id="single-item-attachments-label">
|
||||||
|
<?php echo esc_html( get_theme_mod('tainacan_single_item_attachments_section_label', __( 'Attachments', 'tainacan-interface' )) ); ?>
|
||||||
|
</h2>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( $is_gallery_mode && get_theme_mod('tainacan_single_item_documents_section_label', __( 'Documents', 'tainacan-interface' )) != '') : ?>
|
||||||
|
<h2 class="title-content-items" id="single-item-documents-label">
|
||||||
|
<?php echo esc_html( get_theme_mod('tainacan_single_item_documents_section_label', __( 'Documents', 'tainacan-interface' )) ); ?>
|
||||||
|
</h2>
|
||||||
|
<?php endif; ?>
|
||||||
|
<section class="tainacan-content single-item-collection margin-two-column">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$media_items_thumbs = array();
|
||||||
|
$media_items_main = array();
|
||||||
|
|
||||||
|
if ($is_gallery_mode) {
|
||||||
|
|
||||||
|
$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 ( 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' => (( !get_theme_mod( 'tainacan_single_item_hide_download_document', false ) && 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 ? 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) != '' ) ?
|
||||||
|
'<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 ? 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) : ('<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 ' . ( 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',
|
||||||
|
)
|
||||||
|
) : ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-5 border-bottom border-silver"></div>
|
||||||
|
<?php
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
<?php
|
||||||
|
if (function_exists('tainacan_get_the_attachments')) {
|
||||||
|
$attachments = tainacan_get_the_attachments();
|
||||||
|
} 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,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ( !empty( $attachments ) || ( get_theme_mod( 'tainacan_single_item_gallery_mode', false) && tainacan_has_document() )) : ?>
|
||||||
|
|
||||||
|
<div class="mt-3 tainacan-single-post">
|
||||||
|
<?php if ( !get_theme_mod( 'tainacan_single_item_gallery_mode', false ) && get_theme_mod('tainacan_single_item_attachments_section_label', __( 'Attachments', 'tainacan-interface' )) != '') : ?>
|
||||||
|
<h2 class="title-content-items" id="single-item-attachments-label">
|
||||||
|
<?php echo esc_html( get_theme_mod('tainacan_single_item_attachments_section_label', __( 'Attachments', 'tainacan-interface' )) ); ?>
|
||||||
|
</h2>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( get_theme_mod( 'tainacan_single_item_gallery_mode', false ) && get_theme_mod('tainacan_single_item_documents_section_label', __( 'Documents', 'tainacan-interface' )) != '') : ?>
|
||||||
|
<h2 class="title-content-items" id="single-item-documents-label">
|
||||||
|
<?php echo esc_html( get_theme_mod('tainacan_single_item_documents_section_label', __( 'Documents', 'tainacan-interface' )) ); ?>
|
||||||
|
</h2>
|
||||||
|
<?php endif; ?>
|
||||||
|
<section class="tainacan-content single-item-collection margin-two-column">
|
||||||
|
<?php if (get_theme_mod( 'tainacan_single_item_gallery_mode', false )): ?>
|
||||||
|
<div class="single-item-collection--gallery">
|
||||||
|
<?php if ( tainacan_has_document() ) : ?>
|
||||||
|
<section class="tainacan-content single-item-collection margin-two-column">
|
||||||
|
<div class="single-item-collection--document">
|
||||||
|
<?php
|
||||||
|
tainacan_the_document();
|
||||||
|
if ( !get_theme_mod( 'tainacan_single_item_hide_download_document', false ) && function_exists('tainacan_the_item_document_download_link') && tainacan_the_item_document_download_link() != '' ) {
|
||||||
|
echo '<span class="tainacan-item-file-download">' . tainacan_the_item_document_download_link() . '</span>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php foreach ( $attachments as $attachment ) { ?>
|
||||||
|
<section class="tainacan-content single-item-collection margin-two-column">
|
||||||
|
<div class="single-item-collection--document">
|
||||||
|
<?php
|
||||||
|
if ( function_exists('tainacan_get_single_attachment_as_html') ) {
|
||||||
|
tainacan_get_single_attachment_as_html($attachment->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 '<span class="tainacan-item-file-download">' . tainacan_the_item_attachment_download_link($attachment->ID) . '</span>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php if ( (tainacan_has_document() && $attachments && sizeof($attachments) > 0 ) || (!tainacan_has_document() && $attachments && sizeof($attachments) > 1 ) ) : ?>
|
||||||
|
<div class="single-item-collection--gallery-items">
|
||||||
|
<?php if ( tainacan_has_document() ) : ?>
|
||||||
|
<div class="single-item-collection--attachments-file">
|
||||||
|
<?php
|
||||||
|
the_post_thumbnail('tainacan-medium-full', array('class' => 'item-card--thumbnail mt-2'));
|
||||||
|
echo '<br>';
|
||||||
|
?>
|
||||||
|
<span class="single-item-file-name <?php if (get_theme_mod('tainacan_single_item_hide_files_name', false)) echo 'sr-only' ?>"><?php echo __( 'Document', 'tainacan-interface' ); ?></span>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php foreach ( $attachments as $attachment ) { ?>
|
||||||
|
<div class="single-item-collection--attachments-file">
|
||||||
|
<div class="<?php if (!wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments')) echo'attachment-without-image'; ?>">
|
||||||
|
<?php
|
||||||
|
echo wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments', true );
|
||||||
|
echo '<br>';
|
||||||
|
?>
|
||||||
|
<span class="single-item-file-name <?php if (get_theme_mod('tainacan_single_item_hide_files_name', false)) echo 'sr-only' ?>"><?php echo get_the_title( $attachment->ID ); ?></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<div class="single-item-collection--attachments">
|
||||||
|
<?php foreach ( $attachments as $attachment ) { ?>
|
||||||
|
<?php
|
||||||
|
if ( function_exists('tainacan_get_attachment_html_url') ) {
|
||||||
|
$href = tainacan_get_attachment_html_url($attachment->ID);
|
||||||
|
} else {
|
||||||
|
$href = wp_get_attachment_url($attachment->ID, 'large');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="single-item-collection--attachments-file">
|
||||||
|
<a
|
||||||
|
class="<?php if (!wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments')) echo'attachment-without-image'; ?>"
|
||||||
|
href="<?php echo $href; ?>"
|
||||||
|
data-toggle="lightbox"
|
||||||
|
data-gallery="example-gallery">
|
||||||
|
<?php
|
||||||
|
echo wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments', true );
|
||||||
|
echo '<br>';
|
||||||
|
?>
|
||||||
|
<span class="single-item-file-name <?php if (get_theme_mod('tainacan_single_item_hide_files_name', false)) echo 'sr-only' ?>"><?php echo get_the_title( $attachment->ID ); ?></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php }
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-5 border-bottom border-silver"></div>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
|
@ -56,6 +56,7 @@
|
||||||
<?php do_action( 'tainacan-interface-single-item-metadata-begin' ); ?>
|
<?php do_action( 'tainacan-interface-single-item-metadata-begin' ); ?>
|
||||||
<?php
|
<?php
|
||||||
$args = array(
|
$args = array(
|
||||||
|
'display_slug_as_class' => true,
|
||||||
'before_title' => '<div><h3>',
|
'before_title' => '<div><h3>',
|
||||||
'after_title' => '</h3>',
|
'after_title' => '</h3>',
|
||||||
'before_value' => '<p>',
|
'before_value' => '<p>',
|
||||||
|
|
Loading…
Reference in New Issue