public
Last active

Add after-post widget after posts on your site using the Genesis Framework.

  • Download Gist
functions.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
<?php
//* Do NOT include the opening php tag
 
//* Register after-post widget
genesis_register_sidebar( array(
'id' => 'after-entry',
'name' => __( 'After Entry', 'sample' ),
'description' => __( 'This is the after entry section.', 'sample' ),
) );
 
//* Hook after-entry widget to single posts (inside post class)
add_action( 'genesis_after_post_content', 'bg_after_entry_widget' );
function bg_after_entry_widget() {
if ( is_single() && is_active_sidebar( 'after-entry' ) ) {
echo '<div class="after-entry"><div class="wrap">';
dynamic_sidebar( 'after-entry' );
echo '</div></div>';
}
}
 
//* Hook after-entru widget to single posts (outside post class)
add_action( 'genesis_after_post', 'bg_after_entry_widget', 9 );
function bg_after_entry_widget() {
if ( is_single() && is_active_sidebar( 'after-entry' ) ) {
echo '<div class="after-entry"><div class="wrap">';
dynamic_sidebar( 'after-entry' );
echo '</div></div>';
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.