Adds option to hide title, description and caption on main slider #41

This commit is contained in:
mateuswetah 2021-04-22 09:57:25 -03:00
parent 5d9ff5967d
commit 715aceba28
3 changed files with 78 additions and 5 deletions

View File

@ -612,6 +612,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column;
min-height: 10vh; min-height: 10vh;
> iframe, img.attachment-large { > iframe, img.attachment-large {
@ -642,6 +643,37 @@
bottom: 0; bottom: 0;
} }
} }
.document-metadata {
text-align: center;
&.hide-name .document-metadata__name {
display: none;
visibility: hidden;
}
&.hide-description .document-metadata__description {
display: none;
visibility: hidden;
}
&.hide-caption .document-metadata__caption {
display: none;
visibility: hidden;
}
}
.document-metadata__name {
font-size: 1em;
font-weight: bold;
color: var(--tainacan-label-color, #454647);
}
.document-metadata__caption {
font-size: 0.9375em;
color: var(--tainacan-input-color, #1d1d1d);
}
.document-metadata__caption {
font-size: 0.875em;
color: var(--tainacan-info-color, #555758);
}
} }
.single-item-collection--attachments-prev, .single-item-collection--attachments-prev,
.single-item-collection--attachments-next { .single-item-collection--attachments-next {

View File

@ -47,7 +47,7 @@ if ( !empty( $attachments ) || ( get_theme_mod( 'tainacan_single_item_gallery_m
'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_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_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_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_caption' => $is_document_type_attachment ? wp_get_attachment_caption(tainacan_get_the_document_raw()) : '',
'media_type' => tainacan_get_the_document_type(), 'media_type' => tainacan_get_the_document_type(),
'class_slide_metadata' => $class_slide_metadata 'class_slide_metadata' => $class_slide_metadata
)); ));
@ -81,7 +81,7 @@ if ( !empty( $attachments ) || ( get_theme_mod( 'tainacan_single_item_gallery_m
'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_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_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_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_caption' => $is_document_type_attachment ? wp_get_attachment_caption(tainacan_get_the_document_raw()) : '',
'media_type' => tainacan_get_the_document_type(), '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' : '' ) 'class_slide_metadata' => 'hide-caption hide-description ' . ( get_theme_mod('tainacan_single_item_hide_files_name', false) ? 'hide-name' : '' )
)); ));

View File

@ -1,4 +1,22 @@
<?php if ( tainacan_has_document() && !get_theme_mod( 'tainacan_single_item_gallery_mode', false )) : ?> <?php
if (version_compare(TAINACAN_VERSION, '0.18RC') >= 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);
$is_document_type_attachment = tainacan_get_the_document_type() === 'attachment';
$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() && !get_theme_mod( 'tainacan_single_item_gallery_mode', false )) : ?>
<div class="mt-3 tainacan-single-post"> <div class="mt-3 tainacan-single-post">
<?php if ( get_theme_mod('tainacan_single_item_document_section_label', __( 'Document', 'tainacan-interface' )) != '') : ?> <?php if ( get_theme_mod('tainacan_single_item_document_section_label', __( 'Document', 'tainacan-interface' )) != '') : ?>
<h2 class="title-content-items" id="single-item-document-label"> <h2 class="title-content-items" id="single-item-document-label">
@ -9,9 +27,32 @@
<div class="single-item-collection--document"> <div class="single-item-collection--document">
<?php <?php
tainacan_the_document(); 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() != '' ) {
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>'; echo '<span class="tainacan-item-file-download">' . tainacan_the_item_document_download_link() . '</span>';
}
if ( version_compare(TAINACAN_VERSION, '0.18RC') >= 0 ) {?>
<div class="document-metadata <?php echo $class_slide_metadata ?>">
<?php if ( !$hide_file_caption && $is_document_type_attachment ): ?>
<span class="document-metadata__caption">
<?php echo wp_get_attachment_caption(tainacan_get_the_document_raw()); ?>
<br>
</span>
<?php endif; ?>
<?php if ( !$hide_file_name && $is_document_type_attachment ): ?>
<span class="document-metadata__name">
<?php echo get_the_title(tainacan_get_the_document_raw()); ?>
</span>
<?php endif; ?>
<br>
<?php if ( !$hide_file_description && $is_document_type_attachment ): ?>
<span class="document-metadata__description">
<?php echo get_the_content(tainacan_get_the_document_raw()); ?>
</span>
<?php endif; ?>
</div>
<?php
}
?> ?>
</div> </div>
</section> </section>