Adds option to hide meta info on items single page. Adjusts some spacing and separators.

This commit is contained in:
mateuswetah 2020-04-16 15:36:05 -03:00
parent 469ce95860
commit 82597af66c
6 changed files with 69 additions and 26 deletions

View File

@ -390,6 +390,45 @@ function tainacan_customize_register( $wp_customize ) {
'fallback_refresh' => true
) );
/**
* Adds options to display item autohr and publish date.
*/
$wp_customize->add_setting( 'tainacan_single_item_hide_item_meta', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => false,
'transport' => 'refresh'
) );
$wp_customize->add_control( 'tainacan_single_item_hide_item_meta', array(
'type' => 'checkbox',
'priority' => 2, // Within the section.
'section' => 'tainacan_single_item_page',
'label' => __( 'Hide the item publish date and author', 'tainacan-interface' ),
'description' => __( 'Toggle to not display the item publish date and author name below the item title.', 'tainacan-interface' )
) );
$wp_customize->selective_refresh->add_partial( 'tainacan_single_item_hide_item_meta', array(
'selector' => '.tainacan-single-post .header-meta .time',
'render_callback' => '__return_false',
'fallback_refresh' => true
) );
/**
* Adds options to display or not the document download button.
*/
$wp_customize->add_setting( 'tainacan_single_item_hide_download_document', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => false,
'transport' => 'refresh'
) );
$wp_customize->add_control( 'tainacan_single_item_hide_download_document', array(
'type' => 'checkbox',
'priority' => 2, // Within the section.
'section' => 'tainacan_single_item_page',
'label' => __( 'Hide Document download button', 'tainacan-interface' ),
'description' => __( 'Toggle to never display a "Download" button when hovering the document.', 'tainacan-interface' )
) );
/**
* Adds options to display or not the thumbnail on items page.
*/

View File

@ -14,6 +14,8 @@
get_template_part( 'template-parts/single-items-header' );
do_action( 'tainacan-interface-single-item-after-title' );
echo '<div class="single-item-data-section">';
switch (get_theme_mod( 'tainacan_single_item_layout_sections_order', 'document-attachments-metadata')) {
case 'document-attachments-metadata':
get_template_part( 'template-parts/single-items-document' );
@ -50,6 +52,8 @@
}
echo '</div>';
get_template_part( 'template-parts/single-items-comments' );
?>

View File

@ -106,9 +106,6 @@
</section>
</div>
<div class="tainacan-title my-5">
<div class="border-bottom border-silver tainacan-title-page" style="border-width: 1px !important;">
</div>
</div>
<div class="my-5 border-bottom border-silver"></div>
<?php endif; ?>

View File

@ -1,5 +1,5 @@
<?php if ( tainacan_has_document() && !get_theme_mod( 'tainacan_single_item_gallery_mode', false )) : ?>
<div class="pt-4 tainacan-single-post">
<div class="mt-3 tainacan-single-post">
<?php if ( get_theme_mod('tainacan_single_item_document_section_label', __( 'Document', 'tainacan-interface' )) != '') : ?>
<h2 class="title-content-items" id="single-item-document-label">
<?php echo get_theme_mod('tainacan_single_item_document_section_label', __( 'Document', 'tainacan-interface' )); ?>
@ -7,17 +7,16 @@
<?php endif; ?>
<section class="tainacan-content single-item-collection margin-two-column">
<div class="single-item-collection--document">
<?php tainacan_the_document(); ?>
<?php if( function_exists('tainacan_the_item_document_download_link') && tainacan_the_item_document_download_link() != '' ) {
echo '<span class="tainacan-item-document-download">';
echo tainacan_the_item_document_download_link();
echo '</span>';
} ?>
<?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-document-download">' . tainacan_the_item_document_download_link() . '</span>';
}
?>
</div>
</section>
</div>
<div class="tainacan-title my-5">
<div class="border-bottom border-silver tainacan-title-page" style="border-width: 1px !important;">
</div>
</div>
<div class="my-5 border-bottom border-silver"></div>
<?php endif; ?>

View File

@ -116,18 +116,24 @@ if (get_theme_mod('tainacan_single_item_collection_header', false)) {
<?php endif; ?>
<?php if ( get_theme_mod('tainacan_single_item_collection_header', false) ): ?>
<div class="mt-2 tainacan-single-post collection-single-item aside-thumbnail">
<div class="mt-2 pb-3 tainacan-single-post collection-single-item aside-thumbnail">
<?php else : ?>
<div class="mt-3 tainacan-single-post collection-single-item">
<?php endif; ?>
<header class="mb-4 tainacan-content">
<div class="header-meta text-muted mb-5">
<span class="time"><?php tainacan_meta_date_author(); ?></span>
<?php if( function_exists('tainacan_the_item_edit_link') ) {
echo '<span class="tainacan-edit-item-collection">';
tainacan_the_item_edit_link(null, ' - ');
echo '</span>';
} ?>
<?php
if ( !get_theme_mod('tainacan_single_item_hide_item_meta', false) ) {
echo '<span class="time">';
tainacan_meta_date_author();
echo '</span>';
}
if ( function_exists('tainacan_the_item_edit_link') ) {
echo '<span class="tainacan-edit-item-collection">';
tainacan_the_item_edit_link(null, ' - ');
echo '</span>';
}
?>
</div>
</header>
</div>

View File

@ -57,7 +57,5 @@
</div>
</section>
</div>
<div class="tainacan-title my-5">
<div class="border-bottom border-silver tainacan-title-page" style="border-width: 1px !important;">
</div>
</div>
<div class="my-5 border-bottom border-silver"></div>