Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active March 11, 2017 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save srikat/b31a175c31cce20b7535 to your computer and use it in GitHub Desktop.
Save srikat/b31a175c31cce20b7535 to your computer and use it in GitHub Desktop.
Sample CSS for styling Header Nav Menu in Genesis. http://sridharkatakam.com/sample-css-styling-header-nav-menu-genesis/
<?php
//* Do NOT include the opening php tag
/**********************************
*
* Replace Header Site Title with Inline Logo
* Fix Genesis bug - when using static front page and blog page (admin reading settings) Home page is <p> tag and Blog page is <h1> tag
* Replace "is_home" with "is_front_page" to correctly display Home page wit <h1> tag and Blog page with <p> tag
*
* @author AlphaBlossom / Tony Eppright
* @link http://www.alphablossom.com/a-better-wordpress-genesis-responsive-logo-header/
*
************************************/
add_filter( 'genesis_seo_title', 'abte_header_inline_logo', 10, 3 );
function abte_header_inline_logo( $title, $inside, $wrap ) {
$logo = '<img src="' . get_stylesheet_directory_uri() . '/images/logo.png" alt="' . esc_attr( get_bloginfo( 'name' ) ) . '">';
$inside = sprintf( '<a href="%s" title="%s">%s</a>', trailingslashit( home_url() ), esc_attr( get_bloginfo( 'name' ) ), $logo );
//* Determine which wrapping tags to use - changed is_home to is_front_page to fix Genesis bug
$wrap = is_front_page() && 'title' === genesis_get_seo_option( 'home_h1_on' ) ? 'h1' : 'p';
//* A little fallback, in case an SEO plugin is active - changed is_home to is_front_page to fix Genesis bug
$wrap = is_front_page() && ! genesis_get_seo_option( 'home_h1_on' ) ? 'h1' : $wrap;
//* And finally, $wrap in h1 if HTML5 & semantic headings enabled
$wrap = genesis_html5() && genesis_get_seo_option( 'semantic_headings' ) ? 'h1' : $wrap;
return sprintf( '<%1$s %2$s>%3$s</%1$s>', $wrap, genesis_attr( 'site-title' ), $inside );
}
//* Remove the site description
remove_action( 'genesis_site_description', 'genesis_seo_site_description' );
//* Unregister primary navigation menu
add_theme_support( 'genesis-menus', array( 'secondary' => __( 'Secondary Navigation Menu', 'genesis' ) ) );
.site-header {
background-color: #60534b;
min-height: 0;
}
.site-header .wrap {
padding-top: 0;
padding-bottom: 0;
}
.title-area {
padding-top: 0;
padding-bottom: 0;
width: auto;
}
.title-area img {
vertical-align: top;
}
.site-title a {
display: block;
}
.site-header .widget-area {
margin-left: 50px;
}
.site-header .genesis-nav-menu .menu-item {
vertical-align: middle;
}
.site-header .genesis-nav-menu li a {
color: #fff;
text-transform: uppercase;
text-align: center;
font-weight: bold;
height: 100px;
padding: 30px;
line-height: 1.2;
}
.site-header .genesis-nav-menu li.home a {
padding: 40px 24px 20px 24px;
}
.site-header .widget-area {
text-align: left;
}
.site-header .genesis-nav-menu a:hover,
.site-header .genesis-nav-menu .current-menu-item > a,
.site-header .genesis-nav-menu .sub-menu .current-menu-item > a:hover {
background-color: #a29a51;
color: #fff;
}
.site-header .genesis-nav-menu > .right {
padding: 0;
}
.site-header .genesis-nav-menu > .right > a {
padding: 42px 24px 20px 24px;
display: inline-block;
background-color: #c7b59f;
}
/* 2nd level */
.site-header .sub-menu {
border-top: none;
}
.site-header .genesis-nav-menu .sub-menu,
.site-header .genesis-nav-menu .sub-menu a {
width: 250px;
}
.site-header .genesis-nav-menu .sub-menu a {
height: auto;
background-color: #a29a51;
padding: 10px 20px;
text-align: left;
line-height: 1.3;
font-weight: normal;
border-bottom: 1px solid #4f432d;
border-left: none;
border-right: none;
}
.site-header .genesis-nav-menu .sub-menu a:hover {
background-color: #6e6a18;
}
.site-header .genesis-nav-menu li:hover a {
background-color: #a29a51;
}
.site-header .genesis-nav-menu .sub-menu li:last-child a {
border-bottom: 5px solid #60534b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment