Adds option to change title box opacity.

This commit is contained in:
mateuswetah 2020-04-20 14:44:54 -03:00
parent 4c90f21cab
commit 32dda1e538
4 changed files with 57 additions and 20 deletions

View File

@ -28,7 +28,7 @@
}
.tainacan-collection--change-text-color .control {
margin-top: 1rem;
margin-top: 0.5rem;
}
.tainacan-collection--change-text-color input[type="radio"]::before {
@ -45,8 +45,8 @@
color: #fff;
margin-right: 1rem;
padding: 0.8rem;
border-radius: 3px;
padding: 0.7rem 1.25rem;
border-radius: 2px;
padding: 0.7rem 1.25rem 0.7rem 1.0rem;
font-size: 0.875rem;
}
@ -55,7 +55,11 @@
color: #000;
margin-right: 1rem;
padding: 0.8rem;
border-radius: 3px;
padding: 0.7rem 1.25rem;
border-radius: 2px;
padding: 0.7rem 1.25rem 0.7rem 1.0rem;
font-size: 0.875rem;
}
.tainacan-collection--change-text-color .color-text input[type="radio"] {
border-color: white;
vertical-align: middle;
}

View File

@ -93,19 +93,23 @@ class TainacanThemeCollectionColor {
</div>
</span>
<div class="control is-clearfix">
<input
type="radio"
value="#fff"
name="<?php echo $this->tainacan_text_color; ?>"
id="white" checked>
<label for="white" id="color-white" class="color-text">
<?php _e( 'White', 'tainacan-interface' ); ?></label>
<input
type="radio"
value="#000"
name="<?php echo $this->tainacan_text_color; ?>"
id="black">
<label for="black" id="color-black" class="color-text"><?php _e( 'Black', 'tainacan-interface' ); ?></label>
<label for="white" id="color-white" class="color-text">
<input
type="radio"
value="#fff"
name="<?php echo $this->tainacan_text_color; ?>"
id="white" checked>
<?php _e( 'White', 'tainacan-interface' ); ?>
</label>
<label for="black" id="color-black" class="color-text">
<input
type="radio"
value="#000"
name="<?php echo $this->tainacan_text_color; ?>"
id="black">
<?php _e( 'Black', 'tainacan-interface' ); ?>
</label>
</div>
</div>

View File

@ -146,7 +146,7 @@ function tainacan_customize_register( $wp_customize ) {
* Add color scheme setting and control.
*/
$wp_customize->add_setting( 'tainacan_color_scheme', array(
'type' => 'theme_mod',
'type' => 'theme_mod',
'default' => 'default',
'sanitize_callback' => 'tainacan_sanitize_color_scheme',
'transport' => 'postMessage',
@ -208,6 +208,11 @@ function tainacan_customize_register( $wp_customize ) {
'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->selective_refresh->add_partial( 'tainacan_hide_site_title_on_header_banner', array(
'selector' => '.page-header h1.text-truncate',
'render_callback' => '__return_false',
'fallback_refresh' => true
) );
$wp_customize->add_setting( 'tainacan_hide_header_banner', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
@ -221,6 +226,28 @@ function tainacan_customize_register( $wp_customize ) {
'label' => __( 'Hide the header banner completely', 'tainacan-interface' ),
'description' => __( 'Toggle to hide the header banner from all pages of the site', 'tainacan-interface' )
) );
$wp_customize->add_setting( 'tainacan_hide_header_box_opacity', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => 60,
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'tainacan_hide_header_box_opacity', array(
'type' => 'number',
'section' => 'header_image',
'label' => __( 'Title box opacity (%)' ),
'description' => __( 'Change the opacity of the white box that holds the banner site title' ),
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 5
),
) );
$wp_customize->selective_refresh->add_partial( 'tainacan_hide_header_box_opacity', array(
'selector' => '.page-header .ph-title-description',
'render_callback' => '__return_false',
'fallback_refresh' => true
) );
/**
* Bellow are customizer options exclusivelly related to Tainacan pages.

View File

@ -2,7 +2,9 @@
<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">
<?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
style="background-color: rgba(255, 255, 255, <?php echo (get_theme_mod('tainacan_hide_header_box_opacity', 65)/100) ?>) !important;"
class="title-header <?php if ( is_singular() || is_archive() || is_search() || is_home() ) { echo 'singular-title'; }?>">
<h1 class="mb-0 text-truncate">
<?php bloginfo( 'title' ) ?>
</h1>