Last active
September 18, 2021 19:18
-
-
Save bnecreative/9408ba8a55555c84148c523d67c89f78 to your computer and use it in GitHub Desktop.
Sweetness - 3 column header layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Don't copy this line... | |
/* | |
* WP Customizer Controls | |
* Remove existing Theme Option control as header | |
* layout is now manually defined. | |
* | |
*/ | |
add_action( 'customize_register', function( $wp_customize ) { | |
$wp_customize->remove_control( 'header_columns' ); | |
}, 999 ); | |
/* | |
* Add New Widget Areas to WordPress | |
* | |
*/ | |
add_action( 'widgets_init', function() { | |
register_sidebar( array( | |
'name' => esc_html__( 'Header Content (Left)', 'bne' ), | |
'id' => 'header-sidebar-left', | |
'description' => esc_html__( 'This is the default placeholder for the header content left area.', 'bne' ), | |
'before_widget' => '<div id="%1$s" class="widget %2$s">', | |
'after_widget' => '</div>', | |
'before_title' => '<h3 class="widget-title">', | |
'after_title' => '</h3>', | |
) ); | |
}); | |
/* | |
* Sweetness Header Content Layout | |
* | |
* Redefined within the child theme to override the | |
* default header layout. | |
* | |
* Theme Option header option is ignored. Primary menu location should be | |
* set below the header as the right side is now not available. | |
*/ | |
function bne_header_content() { | |
?> | |
<div class="header-content header-thirds clearfix"> | |
<div class="row grid-protection"> | |
<div class="col-md-4 order-md-2 logo-col clearfix"> | |
<?php do_action( 'bne_header_logo_before' ); ?> | |
<?php bne_header_logo( 'header' ); ?> | |
<?php do_action( 'bne_header_logo_after' ); ?> | |
</div><!-- Center Header Column (end) --> | |
<div class="col-md-4 order-md-1 content-col content-col-left clearfix"> | |
<div class="header-widget-area my-3 my-md-0"> | |
<?php if( !dynamic_sidebar( 'header-sidebar-left' ) ); ?> | |
</div> | |
</div><!-- Left Header Column (end) --> | |
<div class="col-md-4 order-md-3 content-col content-col-right clearfix"> | |
<div class="header-widget-area my-3 my-md-0"> | |
<?php if( !dynamic_sidebar( 'header-sidebar' ) ); ?> | |
</div> | |
</div><!-- Right Header Column (end) --> | |
</div><!-- .row (end) --> | |
</div><!-- .header-content (end) --> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment