Skip to content

Instantly share code, notes, and snippets.

@wbxpress
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wbxpress/43281d2199bef98b90c4 to your computer and use it in GitHub Desktop.
Save wbxpress/43281d2199bef98b90c4 to your computer and use it in GitHub Desktop.
//* Add new widget area between posts of home page
genesis_register_sidebar( array(
'id' => 'between-posts-area',
'name' => __( 'Between Posts Area', 'genesis-theme' ),
'description' => __( 'This widget show between and after few posts.', 'genesis-theme' ),
) );
//* Add widget area between and after 2 posts
add_action( 'genesis_after_entry', 'wbxp_between_posts_area' );
function wbxp_between_posts_area() {
global $loop_counter;
$loop_counter++;
if( $loop_counter == 2 ) {
if ( is_active_sidebar( 'between-posts-area' ) ) {
echo '<div class="wbxp-google-ads">';
dynamic_sidebar( 'between-posts-area' );
echo '</div><!-- end .top -->';
}
$loop_counter = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment