Allows setting collection banner max-height #42

This commit is contained in:
mateuswetah 2021-04-22 11:51:53 -03:00
parent 16c42cc35d
commit 384c1a9352
2 changed files with 43 additions and 3 deletions

View File

@ -956,6 +956,46 @@ function tainacan_customize_register( $wp_customize ) {
'priority' => 160 // Mixed with top-level-section hierarchy.,
) );
/**
* Adds section to settings related to search control . ---------------------------------------------------------
*/
$wp_customize->add_section( 'tainacan_items_page_collection_banner', array(
'title' => __( 'Collection Header', 'tainacan-interface' ),
'description' => __( 'Settings related to Tainacan items list colleciton header.', 'tainacan-interface' ),
'panel' => 'tainacan_items_page',
'priority' => 160,
'capability' => 'edit_theme_options'
) );
/**
* Allows setting max heigth of collection banner ---------------------------------------------------------
*/
$wp_customize->add_setting( 'tainacan_collection_banner_max_height', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => 624,
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text_field'
) );
$wp_customize->add_control( 'tainacan_collection_banner_max_height', array(
'type' => 'number',
'section' => 'tainacan_items_page_collection_banner',
'label' => __( 'Collection banner image maximum height (px)', 'tainacan-interface' ),
'input_attrs' => array(
'min' => 142,
'max' => 624,
'step' => 1
),
) );
$wp_customize->selective_refresh->add_partial( 'tainacan_collection_banner_max_height', array(
'selector' => '.page-header img',
'render_callback' => '__return_false',
'fallback_refresh' => true
) );
/**
* Adds section to settings related to search control . ---------------------------------------------------------
*/

View File

@ -25,13 +25,13 @@ echo '</style>';
<?php if ( get_header_image_tag() ) : ?>
<div class="page-header header-filter page-height page-header--image-full">
<?php echo get_header_image_tag() ?>
<?php echo get_header_image_tag(array( "style" => "max-height: " . get_theme_mod('tainacan_collection_banner_max_height', 624 ) . 'px;' )) ?>
<?php elseif ( get_header_image() ) : ?>
<div class="page-header header-filter page-height page-header--image-full">
<img class="page-header__image" src="<?php header_image(); ?>" alt="Imagem">
<img class="page-header__image" src="<?php header_image(); ?>" alt="">
<?php else : ?>
<div class="page-header header-filter page-collection page-header--image-full">
<img class="page-header__image" src="<?php echo esc_url( get_template_directory_uri() ) ?>/assets/images/capa.png" alt="Imagem">
<img class="page-header__image" src="<?php echo esc_url( get_template_directory_uri() ) ?>/assets/images/capa.png" alt="">
<?php endif; ?>
<div class="container-fluid px-0 t-bg-collection" style="<!-- z-index: 0; -->">
<div class="collection-header position-relative max-large" style="">