Skip to content

Instantly share code, notes, and snippets.

@jpmarchand
Last active June 1, 2017 15:49
Show Gist options
  • Save jpmarchand/aaa3bb4532156b256630 to your computer and use it in GitHub Desktop.
Save jpmarchand/aaa3bb4532156b256630 to your computer and use it in GitHub Desktop.
Register and display a new widget area in Genesis. Source: https://my.studiopress.com/documentation/tutorials/widget-areas/register-a-widget-area/
<?php
//* Register After Post widget area
genesis_register_sidebar( array(
'id' => 'after-post',
'name' => __( 'After Post', 'themename' ),
'description' => __( 'This is a widget area that can be placed after the post', 'themename' ),
) );
//* Hook After Post widget area after post content
add_action( 'genesis_entry_footer', 'customprefix_after_post_widget' );
function customprefix_after_post_widget() {
if ( is_singular( 'post' ) ) {
genesis_widget_area( 'after-post', array(
'before' => '<div class="after-post widget-area">',
'after' => '</div>',
) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment