Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Temmyhlee/440a1c609a1e1dea8bc690b1be446d8c to your computer and use it in GitHub Desktop.
Save Temmyhlee/440a1c609a1e1dea8bc690b1be446d8c to your computer and use it in GitHub Desktop.
New Widget between Posts in Genesis Theme
//* Add new widget Between Posts Area
genesis_register_sidebar( array(
'id' => 'between-posts-area',
'name' => __( 'Between Posts Area', 'basicwp-theme' ),
'description' => __( 'This widget show between and after few posts.', 'basicwp-theme' ),
) );
//* Add widget area between and after 3 posts
add_action( 'genesis_after_entry', 'basicwptheme_between_posts_area' );
function basicwptheme_between_posts_area() {
global $loop_counter;
$loop_counter++;
if( $loop_counter == 3 ) {
if ( is_active_sidebar( 'between-posts-area' ) ) {
echo '<div class="between-posts-area widget-area"><div class="wrap">';
dynamic_sidebar( 'between-posts-area' );
echo '</div></div><!-- end .top -->';
}
$loop_counter = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment