Adds option to hide header banner and header banner title. #22

This commit is contained in:
mateuswetah 2020-04-08 10:51:13 -03:00
parent 29e7a8b1a2
commit 5931939dfd
4 changed files with 42 additions and 10 deletions

View File

@ -3,7 +3,6 @@
<!-- Get the banner to display --> <!-- Get the banner to display -->
<?php get_template_part( 'template-parts/bannerheader' ); ?> <?php get_template_part( 'template-parts/bannerheader' ); ?>
<main role="main" class="mt-5 max-large margin-one-column"> <main role="main" class="mt-5 max-large margin-one-column">
<div class="row justify-content-between"> <div class="row justify-content-between">
<div class="col-12 <?php if ( is_active_sidebar( 'tainacan-sidebar-right' ) ) { ?>col-lg-8 pr-lg-0<?php } ?>"> <div class="col-12 <?php if ( is_active_sidebar( 'tainacan-sidebar-right' ) ) { ?>col-lg-8 pr-lg-0<?php } ?>">

View File

@ -192,6 +192,36 @@ function tainacan_customize_register( $wp_customize ) {
'section' => 'colors', 'section' => 'colors',
) ) ); ) ) );
/**
* Adds option to hide Website Title on the Header Image cover, or the whole banner.
*/
$wp_customize->add_setting( 'tainacan_hide_site_title_on_header_banner', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => false,
'transport' => 'refresh'
) );
$wp_customize->add_control( 'tainacan_hide_site_title_on_header_banner', array(
'type' => 'checkbox',
'priority' => 99, // Within the section.
'section' => 'header_image',
'label' => __( 'Hide the header banner site title', 'tainacan-interface' ),
'description' => __( 'Toggle to hide the site title row that appears over the header banner', 'tainacan-interface' )
) );
$wp_customize->add_setting( 'tainacan_hide_header_banner', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => false,
'transport' => 'refresh'
) );
$wp_customize->add_control( 'tainacan_hide_header_banner', array(
'type' => 'checkbox',
'priority' => 98, // Within the section.
'section' => 'header_image',
'label' => __( 'Hide the header banner completely', 'tainacan-interface' ),
'description' => __( 'Toggle to hide the header banner from all pages of the site', 'tainacan-interface' )
) );
/** /**
* Adds section to control singe items page. * Adds section to control singe items page.
*/ */

View File

@ -3,7 +3,6 @@
<!-- Get the banner to display --> <!-- Get the banner to display -->
<?php get_template_part( 'template-parts/bannerheader' ); ?> <?php get_template_part( 'template-parts/bannerheader' ); ?>
<main role="main" class="mt-5 max-large margin-one-column"> <main role="main" class="mt-5 max-large margin-one-column">
<div class="row justify-content-between"> <div class="row justify-content-between">
<div class="col-12 <?php if ( is_active_sidebar( 'tainacan-sidebar-right' ) ) { ?>col-lg-8 pr-lg-0<?php } ?>"> <div class="col-12 <?php if ( is_active_sidebar( 'tainacan-sidebar-right' ) ) { ?>col-lg-8 pr-lg-0<?php } ?>">

View File

@ -1,10 +1,14 @@
<div <?php if ( get_header_image() ) : ?>class="page-header header-filter clear-filter page-height" style="background-image: url('<?php header_image(); ?>')"<?php else : ?>class="page-header header-filter clear-filter align-items-center" style="background-image: url('<?php echo esc_url( get_template_directory_uri() ) ?>/assets/images/capa.png')"<?php endif; ?>> <?php if ( false == get_theme_mod( 'tainacan_hide_header_banner', false ) ) : ?>
<div <?php if ( get_header_image() ) : ?>class="page-header header-filter clear-filter page-height" style="background-image: url('<?php header_image(); ?>')"<?php else : ?>class="page-header header-filter clear-filter align-items-center" style="background-image: url('<?php echo esc_url( get_template_directory_uri() ) ?>/assets/images/capa.png')"<?php endif; ?>>
<div class="container-fluid p-0 ph-title-description"> <div class="container-fluid p-0 ph-title-description">
<?php if ( false == get_theme_mod( 'tainacan_hide_site_title_on_header_banner', false ) ) : ?>
<div class="bg-white-title title-header <?php if ( is_singular() || is_archive() || is_search() || is_home() ) { echo 'singular-title'; }?>"> <div class="bg-white-title title-header <?php if ( is_singular() || is_archive() || is_search() || is_home() ) { echo 'singular-title'; }?>">
<h1 class="mb-0 text-truncate"> <h1 class="mb-0 text-truncate">
<?php bloginfo( 'title' ) ?> <?php bloginfo( 'title' ) ?>
</h1> </h1>
<?php do_action( 'tainacan-interface-banner-header-description' ); ?> <?php do_action( 'tainacan-interface-banner-header-description' ); ?>
</div> </div>
<?php endif; ?>
</div> </div>
</div> </div>
<?php endif; ?>