Skip to content

Instantly share code, notes, and snippets.

@SiGaCode
Created February 28, 2015 09:38
Show Gist options
  • Save SiGaCode/f557aeaa08c13e276b97 to your computer and use it in GitHub Desktop.
Save SiGaCode/f557aeaa08c13e276b97 to your computer and use it in GitHub Desktop.
Create a custom header with individual markup. Credits Junior Atoms: http://cobaltapps.com/forum/forum/main-category/web-design-talk/50804-2-questions-how-to-add-primary-nav-to-custom-header-adding-more-menus-via-functions Goes to Dynamik Custom - Functions
//* Create a custom header and menu
//* Remove header
remove_action('genesis_header', 'genesis_header_markup_open', 5);
remove_action('genesis_header', 'genesis_do_header');
remove_action('genesis_header', 'genesis_header_markup_close', 15);
//* Unregister header-right widget-area
unregister_sidebar( 'header-right' );
//* Register third menu
register_nav_menu( 'third', 'Third Navigation Menu' );
//* Add schema attributes to third menu
add_filter( 'genesis_attr_nav-third', 'genesis_attributes_nav' );
//* Add new header with third menu
add_action('genesis_header', 'anka_zap_header');
function anka_zap_header() { ?>
<header class="site-header" role="banner" itemscope="itemscope" itemtype="http://schema.org/WPHeader">
<div class="wrap">
<?php genesis_nav_menu( array( 'theme_location' => 'third', 'menu_class' => 'menu genesis-nav-menu menu-third', ) ); ?>
<?php genesis_seo_site_title(); ?>
<?php genesis_seo_site_description(); ?>
</div>
</header>
<?php }
unregister_sidebar( 'header-right' );
//* Remove primary navigation
remove_action( 'genesis_after_header', 'genesis_do_nav' );
//* Add anka-header-wrap
add_action( 'genesis_header', 'anka_header_wrap_open', 6 );
function anka_header_wrap_open() {
echo '<div class="anka-header-wrap">';
}
//* Add primary navigation
add_action( 'genesis_header', 'genesis_do_nav', 7 );
//* Add anka-div-1
add_action( 'genesis_header', 'anka_div_1', 8 );
function anka_div_1() {
echo '<div class="anka-div-1"><p>Anka div one!</p></div>';
}
//* Add anka-div-2
add_action( 'genesis_header', 'anka_div_2', 9 );
function anka_div_2() {
echo '<div class="anka-div-2"><p>Anka div two!</p></div>';
}
//* Close anka-header-wrap
add_action( 'genesis_header', 'anka_header_wrap_close', 14 );
function anka_header_wrap_close() {
echo '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment