Created
March 21, 2018 16:09
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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