Skip to content

Instantly share code, notes, and snippets.

@bnecreative
Last active September 18, 2021 19:18
Show Gist options
  • Save bnecreative/9408ba8a55555c84148c523d67c89f78 to your computer and use it in GitHub Desktop.
Save bnecreative/9408ba8a55555c84148c523d67c89f78 to your computer and use it in GitHub Desktop.
Sweetness - 3 column header layout
<?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