Skip to content

Instantly share code, notes, and snippets.

@braddalton
Last active December 31, 2015 22:09
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 braddalton/d5508cb2aaf2a8c032ed to your computer and use it in GitHub Desktop.
Save braddalton/d5508cb2aaf2a8c032ed to your computer and use it in GitHub Desktop.
/** Register New Widget */
genesis_register_sidebar( array(
'id' => 'first-post',
'name' => __( 'Widget After First Post', 'wpsites' ),
'description' => __( 'Displays Your Widget Content After The First Post.', 'wpsites' ),
) );
add_action( 'genesis_after_entry', 'widget_after_first_post' );
/**
* Brad Dalton
* example http://wpsites.net/web-design/add-content-after-any-number-of-post-excerpts-in-any-type-of-archive/
*/
function widget_after_first_post() {
global $post_count;
++$post_count;
if ( ( is_front_page() ) && 1 == $post_count ) {
genesis_widget_area( 'first-post', array(
'before' => '<div class="first-post widget-area">',
'after' => '</div>',
) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment