diff --git a/src/assets/scss/style.scss b/src/assets/scss/style.scss index 5647266..cd5e868 100644 --- a/src/assets/scss/style.scss +++ b/src/assets/scss/style.scss @@ -487,6 +487,33 @@ nav { & > .container-fluid { 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 { diff --git a/src/functions/customizer.php b/src/functions/customizer.php index de77b95..274bf2c 100644 --- a/src/functions/customizer.php +++ b/src/functions/customizer.php @@ -138,6 +138,24 @@ function tainacan_customize_register( $wp_customize ) { '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 $wp_customize->add_setting( 'tainacan_fixed_header', array( '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 + + +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. * diff --git a/src/header.php b/src/header.php index 6d1c963..0eb19e7 100644 --- a/src/header.php +++ b/src/header.php @@ -20,7 +20,7 @@ ?>