Skip to content

Instantly share code, notes, and snippets.

@adambradford
Created March 21, 2018 16:09
Show Gist options
  • Save adambradford/3394d45065fa6ccc840835bcc772ed67 to your computer and use it in GitHub Desktop.
Save adambradford/3394d45065fa6ccc840835bcc772ed67 to your computer and use it in GitHub Desktop.
Add Before Sidebar widget area in a WordPress site built with the Genesis Framework
<?php
//* Add this to your functions.php file. Do NOT include the opening php tag
//* Add Before Sidebar widget area
genesis_register_sidebar( array(
'id' => 'before-sidebar',
'name' => __( 'Before Sidebar', 'themename' ),
'description' => __( 'This is a widget area that can be placed above the sidebar', 'themename' ),
) );
//* Hook Before Sidebar widget area before sidebar
add_action( 'genesis_before_content', 'ab_before_sidebar_widget' );
function ab_before_sidebar_widget() {
genesis_widget_area( 'before-sidebar', array(
'before' => '<div class="before-sidebar widget-area">',
'after' => '</div>',
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment