Last active
March 7, 2017 18:08
-
-
Save braddalton/4741976 to your computer and use it in GitHub Desktop.
Add Widget Before Content On Single Page In Genesis Using Conditional Tag
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
// Register before-content widget | |
genesis_register_sidebar( array( | |
'id' => 'before-content', | |
'name' => __( 'Before Content', 'agency' ), | |
'description' => __( 'This is the before-content section.', 'agency' ), | |
) ); | |
// Hook before-post widget to single page | |
add_action( 'genesis_before_content_sidebar_wrap', 'custom_before_content', 9 ); | |
function custom_before_content() { | |
if ( is_page('386') && is_active_sidebar( 'before-content' ) ) { | |
echo '<div class="before-content"><div class="wrap">'; | |
dynamic_sidebar( 'before-content' ); | |
echo '</div></div>'; | |
} | |
} | |
//Add Widget Before Content On Single Page with I.D 386 | |
//Change the conditional tag to suit your needs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you! worked like a charm.