Avoids displaying customizer options that can not be enabled if Tainacan Version does not offer support.
This commit is contained in:
parent
57f6cf1627
commit
c17cef05ad
|
@ -286,44 +286,46 @@ function tainacan_customize_register( $wp_customize ) {
|
||||||
)
|
)
|
||||||
) );
|
) );
|
||||||
|
|
||||||
/**
|
if (version_compare(TAINACAN_VERSION, '0.16') <= 0) {
|
||||||
* Adds option to display Collection banner on the item single page.
|
/**
|
||||||
*/
|
* Adds option to display Collection banner on the item single page.
|
||||||
$wp_customize->add_setting( 'tainacan_single_item_collection_header', array(
|
*/
|
||||||
'type' => 'theme_mod',
|
$wp_customize->add_setting( 'tainacan_single_item_collection_header', array(
|
||||||
'capability' => 'edit_theme_options',
|
'type' => 'theme_mod',
|
||||||
'default' => false,
|
'capability' => 'edit_theme_options',
|
||||||
'transport' => 'postMessage'
|
'default' => false,
|
||||||
) );
|
'transport' => 'postMessage'
|
||||||
$wp_customize->add_control( 'tainacan_single_item_collection_header', array(
|
) );
|
||||||
'type' => 'checkbox',
|
$wp_customize->add_control( 'tainacan_single_item_collection_header', array(
|
||||||
'priority' => 0, // Within the section.
|
'type' => 'checkbox',
|
||||||
'section' => 'tainacan_single_item_page',
|
'priority' => 0, // Within the section.
|
||||||
'label' => __( 'Display a header of the related collection.', 'tainacan-interface' ),
|
'section' => 'tainacan_single_item_page',
|
||||||
'description' => __( 'Toggle to show a banner with name, thumbnail and color of the related collection.', 'tainacan-interface' )
|
'label' => __( 'Display a header of the related collection.', 'tainacan-interface' ),
|
||||||
) );
|
'description' => __( 'Toggle to show a banner with name, thumbnail and color of the related collection.', 'tainacan-interface' )
|
||||||
$wp_customize->selective_refresh->add_partial( 'tainacan_single_item_collection_header', array(
|
) );
|
||||||
'selector' => '.tainacan-single-item-heading',
|
$wp_customize->selective_refresh->add_partial( 'tainacan_single_item_collection_header', array(
|
||||||
'render_callback' => '__return_false',
|
'selector' => '.tainacan-single-item-heading',
|
||||||
'fallback_refresh' => true
|
'render_callback' => '__return_false',
|
||||||
) );
|
'fallback_refresh' => true
|
||||||
|
) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds option to display attachments and document as a gallery list.
|
* Adds option to display attachments and document as a gallery list.
|
||||||
*/
|
*/
|
||||||
$wp_customize->add_setting( 'tainacan_single_item_gallery_mode', array(
|
$wp_customize->add_setting( 'tainacan_single_item_gallery_mode', array(
|
||||||
'type' => 'theme_mod',
|
'type' => 'theme_mod',
|
||||||
'capability' => 'edit_theme_options',
|
'capability' => 'edit_theme_options',
|
||||||
'default' => false,
|
'default' => false,
|
||||||
'transport' => 'refresh'
|
'transport' => 'refresh'
|
||||||
) );
|
) );
|
||||||
$wp_customize->add_control( 'tainacan_single_item_gallery_mode', array(
|
$wp_customize->add_control( 'tainacan_single_item_gallery_mode', array(
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'priority' => 0, // Within the section.
|
'priority' => 0, // Within the section.
|
||||||
'section' => 'tainacan_single_item_page',
|
'section' => 'tainacan_single_item_page',
|
||||||
'label' => __( 'Show "Documents" section: Document and Attachments grouped in one slider.', 'tainacan-interface' ),
|
'label' => __( 'Show "Documents" section: Document and Attachments grouped in one slider.', 'tainacan-interface' ),
|
||||||
'description' => __( 'Toggle to show the document and attachments in the same list, a carousel with the current item on top.', 'tainacan-interface' )
|
'description' => __( 'Toggle to show the document and attachments in the same list, a carousel with the current item on top.', 'tainacan-interface' )
|
||||||
) );
|
) );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds option to configure Document section label.
|
* Adds option to configure Document section label.
|
||||||
|
@ -452,22 +454,24 @@ function tainacan_customize_register( $wp_customize ) {
|
||||||
'fallback_refresh' => true
|
'fallback_refresh' => true
|
||||||
) );
|
) );
|
||||||
|
|
||||||
/**
|
if (version_compare(TAINACAN_VERSION, '0.16') <= 0) {
|
||||||
* Adds options to display or not the document download button.
|
/**
|
||||||
*/
|
* Adds options to display or not the document download button.
|
||||||
$wp_customize->add_setting( 'tainacan_single_item_hide_download_document', array(
|
*/
|
||||||
'type' => 'theme_mod',
|
$wp_customize->add_setting( 'tainacan_single_item_hide_download_document', array(
|
||||||
'capability' => 'edit_theme_options',
|
'type' => 'theme_mod',
|
||||||
'default' => false,
|
'capability' => 'edit_theme_options',
|
||||||
'transport' => 'refresh'
|
'default' => false,
|
||||||
) );
|
'transport' => 'refresh'
|
||||||
$wp_customize->add_control( 'tainacan_single_item_hide_download_document', array(
|
) );
|
||||||
'type' => 'checkbox',
|
$wp_customize->add_control( 'tainacan_single_item_hide_download_document', array(
|
||||||
'priority' => 2, // Within the section.
|
'type' => 'checkbox',
|
||||||
'section' => 'tainacan_single_item_page',
|
'priority' => 2, // Within the section.
|
||||||
'label' => __( 'Hide Document download button', 'tainacan-interface' ),
|
'section' => 'tainacan_single_item_page',
|
||||||
'description' => __( 'Toggle to never display a "Download" button when hovering the document.', 'tainacan-interface' )
|
'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.
|
* Adds options to display or not the thumbnail on items page.
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<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>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue