You can easily change the conditional tag or install the Widget Logic plugin to control where you want to output your widget content.
You can also use this code to add a widget after your content area or after your posts in single posts or all pages of your site.
Add Widget Before Content On All Single Posts
Add Widget Before Content On Home Page
Add Widget Before Content On Specific Page
genesis_register_sidebar( array(
'id' => 'before-content',
'name' => __( 'Before Content', 'wpsites' ),
'description' => __( 'Content Displays Before Specific Pages Content.', 'wpsites' ),
) );
add_action( 'genesis_before_content', 'wpsites_widget_before_content' );
function wpsites_widget_before_content() {
if ( is_page('007') && is_active_sidebar('before-content') ) {
genesis_widget_area( 'before-content', array(
'before' => '<div class="before-content" class="widget-area">',
'after' => '</div>',
) );
}
}
Replace the post/page i.d (007) with your own.
Change Hook Position
To change the position your widget displays, simply change genesis_before_content
in the code to any other hook position.
Video Tutorial – How To Add Widget In Genesis Theme
Conclusion
There’s so many variables when it comes to adding a widget area in WordPress that its impossible to cover all bases.
Once you have a basic understanding of conditional tags, your themes hook locations and basic CSS, you can modify this code to suit your own needs.
Was This Tutorial Helpful?