Adds center alignmente option to site header. #48.
This commit is contained in:
parent
22e8a530d5
commit
25b456a6ae
|
@ -487,6 +487,33 @@ nav {
|
||||||
& > .container-fluid {
|
& > .container-fluid {
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.tainacan-header-layout--center #topNavbar {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
margin: 0px auto !important;
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
.navbar-box {
|
||||||
|
justify-content: center;
|
||||||
|
margin: 0px !important;
|
||||||
|
|
||||||
|
nav.menu-belowheader {
|
||||||
|
.container-fluid {
|
||||||
|
margin: 0px 16px !important;
|
||||||
|
}
|
||||||
|
#menubelowHeader > ul > li.menu-item {
|
||||||
|
padding-left: 20px;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
#menubelowHeader > ul {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.navbar.navbar--border-bottom {
|
.navbar.navbar--border-bottom {
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,24 @@ function tainacan_customize_register( $wp_customize ) {
|
||||||
'panel' => 'tainacan_header_settings'
|
'panel' => 'tainacan_header_settings'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds options to align header elements
|
||||||
|
*/
|
||||||
|
$wp_customize->add_setting( 'tainacan_header_alignment_options', array(
|
||||||
|
'type' => 'theme_mod',
|
||||||
|
'capability' => 'edit_theme_options',
|
||||||
|
'default' => 'default',
|
||||||
|
'transport' => 'refresh',
|
||||||
|
'sanitize_callback' => 'tainacan_sanitize_header_alignment_options',
|
||||||
|
) );
|
||||||
|
$wp_customize->add_control( 'tainacan_header_alignment_options', array(
|
||||||
|
'type' => 'select',
|
||||||
|
'section' => 'tainacan_header_general',
|
||||||
|
'label' => __( 'Header elements alignment', 'tainacan-interface' ),
|
||||||
|
'description' => __( 'Sets how the header elements, such as the logo and navigation menu are aligned.', 'tainacan-interface' ),
|
||||||
|
'choices' => tainacan_get_header_alignment_options()
|
||||||
|
) );
|
||||||
|
|
||||||
// Fixed header
|
// Fixed header
|
||||||
$wp_customize->add_setting( 'tainacan_fixed_header', array(
|
$wp_customize->add_setting( 'tainacan_fixed_header', array(
|
||||||
'type' => 'theme_mod',
|
'type' => 'theme_mod',
|
||||||
|
@ -2038,6 +2056,54 @@ if ( ! function_exists( 'tainacan_sanitize_single_item_navigation_links_options'
|
||||||
}
|
}
|
||||||
endif; // tainacan_sanitize_single_item_navigation_links_options
|
endif; // tainacan_sanitize_single_item_navigation_links_options
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ( ! function_exists( 'tainacan_get_header_alignment_options' ) ) :
|
||||||
|
/**
|
||||||
|
* Retrieves an array of options for header alignment options for Tainacan Theme.
|
||||||
|
*
|
||||||
|
* Create your own tainacan_get_header_alignment_options() function to override
|
||||||
|
* in a child theme.
|
||||||
|
*
|
||||||
|
* @since Tainacan Theme
|
||||||
|
*
|
||||||
|
* @return array $option - a string with options for header alignments.
|
||||||
|
*/
|
||||||
|
function tainacan_get_header_alignment_options() {
|
||||||
|
$header_alignment_options = array(
|
||||||
|
'default' => __('One line, spaced', 'tainacan-interface'),
|
||||||
|
// 'left' => __('Two lines, to the left', 'tainacan-interface'),
|
||||||
|
'center' => __('Two lines, centered', 'tainacan-interface')
|
||||||
|
);
|
||||||
|
return $header_alignment_options;
|
||||||
|
}
|
||||||
|
endif; // tainacan_get_header_alignment_options
|
||||||
|
|
||||||
|
if ( ! function_exists( 'tainacan_sanitize_header_alignment_options' ) ) :
|
||||||
|
/**
|
||||||
|
* Handles sanitization for Tainacan Theme item page navigation link options
|
||||||
|
*
|
||||||
|
* Create your own tainacan_sanitize_header_alignment_options() function to override
|
||||||
|
* in a child theme.
|
||||||
|
*
|
||||||
|
* @since Tainacan Theme
|
||||||
|
*
|
||||||
|
* @param string $option - a string with options for hader alignments.
|
||||||
|
* @return string the selected option.
|
||||||
|
*/
|
||||||
|
function tainacan_sanitize_header_alignment_options( $option ) {
|
||||||
|
$header_alignment_options = tainacan_get_header_alignment_options();
|
||||||
|
|
||||||
|
if ( ! array_key_exists( $option, $header_alignment_options ) ) {
|
||||||
|
return 'default';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $option;
|
||||||
|
}
|
||||||
|
endif; // tainacan_sanitize_header_alignment_options
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueues front-end CSS for color scheme.
|
* Enqueues front-end CSS for color scheme.
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
?>
|
?>
|
||||||
<nav
|
<nav
|
||||||
style="min-height: <?php echo get_theme_mod('tainacan_header_min_height', 50) ?>px;"
|
style="min-height: <?php echo get_theme_mod('tainacan_header_min_height', 50) ?>px;"
|
||||||
class="navbar navbar-expand-md navbar-light bg-white menu-shadow px-0 navbar--border-bottom">
|
class="navbar navbar-expand-md navbar-light bg-white menu-shadow px-0 navbar--border-bottom <?php echo 'tainacan-header-layout--' . get_theme_mod('tainacan_header_alignment_options', 'default'); ?>">
|
||||||
<div class="container-fluid max-large px-0 margin-one-column" id="topNavbar">
|
<div class="container-fluid max-large px-0 margin-one-column" id="topNavbar">
|
||||||
<?php echo tainacan_get_logo(); ?>
|
<?php echo tainacan_get_logo(); ?>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue