Skip to content

Instantly share code, notes, and snippets.

@mbrughi
Last active January 18, 2018 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbrughi/3a0ec86c3b74eb640c8059ddf37be72a to your computer and use it in GitHub Desktop.
Save mbrughi/3a0ec86c3b74eb640c8059ddf37be72a to your computer and use it in GitHub Desktop.
Wordpress: Genesis, create a “Top Bar” Widget Area Above Header
/** Register TOP Bar Widget Areas. */
genesis_register_sidebar( array(
'id' => 'top-bar-left',
'name' => __( 'Top Bar Left', 'my-theme' ),
'description' => __( 'This is the left TOP bar above the header.', 'sinergica-theme' ),
) );
genesis_register_sidebar( array(
'id' => 'top-bar-right',
'name' => __( 'Top Bar Right', 'my-theme' ),
'description' => __( 'This is the right TOP bar above the header.', 'sinergica-theme' ),
) );
/* Insert/Add Top Bar into theme */
add_action( 'genesis_before_header', 'top_bar' );
function top_bar() {
echo '<div class="top-bar"><div class="wrap">';
genesis_widget_area( 'top-bar-left', array(
'before' => '<div class="top-bar-left">',
'after' => '</div>',
) );
genesis_widget_area( 'top-bar-right', array(
'before' => '<div class="top-bar-right">',
'after' => '</div>',
) );
echo '</div></div>';
}
/* Top Bar
--------------------------------------------- */
.top-bar {
background-color: #333;
border-bottom: 0px solid #ddd;
color: #ddd;
font-size: 12px;
font-size: 1.2rem;
padding: 10px 0;
padding: 1rem;
/* Fixed Options */
z-index: 9999; position: fixed; left: 0; top: 0; width: 100%;
}
.top-bar a {
color: #ccff33;
}
.top-bar a:hover {
text-decoration: underline;
}
.top-bar-left,
.top-bar-right {
width: 50%;
}
.top-bar-left p,
.top-bar-right p {
margin-bottom: 0;
}
.top-bar-left {
float: left;
}
.top-bar-right {
float: right;
text-align: right;
}
.top-bar input[type="search"] {
background: inherit;
padding: 10px 0 0;
padding: 1.0rem 0 0;
}
/* Top Bar
--------------------------------------------- */
.top-bar {
background-color: #333;
border-bottom: 0px solid #ddd;
color: #ddd;
font-size: 12px;
font-size: 1.2rem;
padding: 10px 0;
padding: 1rem;
}
.top-bar a {
color: #ccff33;
}
.top-bar a:hover {
text-decoration: underline;
}
.top-bar-left,
.top-bar-right {
width: 50%;
}
.top-bar-left p,
.top-bar-right p {
margin-bottom: 0;
}
.top-bar-left {
float: left;
}
.top-bar-right {
float: right;
text-align: right;
}
.top-bar input[type="search"] {
background: inherit;
padding: 10px 0 0;
padding: 1.0rem 0 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment