How to add a widget area between posts?
-
Well I’m pretty new at this, but I managed to make the widget area between the posts, but the problem is that the widget appears after EVERY post of my blog (i.e, I have 5 posts and it creates a widget for each post — 5 total widget areas) How do I make just one widget area between my blog posts? (i.e, post–post–widget area–post–post–post–etc)
I understand I have to use a $loop_counter but where do I put this, or if not then what should I do?
/** Register Widget Box widget area */
genesis_register_sidebar( array(
‘id’ => ‘widget-box’,
‘name’ => __( ‘Widget Box’, ‘genesis’ ),
‘description’ => __( ‘This is the widget box’, ‘genesis’ ),
) );/** Add Widget Box between posts on homepage */
add_action( ‘genesis_after_post’, ‘include_widget_box’ );
function include_widget_box() {
if ( is_home() && is_active_sidebar( ‘widget-box’ ) ) {
echo ‘<div class=”widget-box”>’;
dynamic_sidebar( ‘widget-box’ );
echo ‘</div><!– end .widget-box –>’;
}}[ Please do not bump, that’s not permitted here. ]
- The topic ‘How to add a widget area between posts?’ is closed to new replies.