Widget is displaying on all pages

Community Forums Forums General Discussion Widget is displaying on all pages

This topic is: resolved

This topic contains 2 replies, has 2 voices, and was last updated by  SimplyAA 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #102830

    SimplyAA
    Participant
    Post count: 67

    I am using the Streamline theme. I created a new widget by using the code below. I only want it to appear on the home page but it appears on all pages. I thought I was limiting as below it says if is HOME but it shows on all pages here: http://www.getlevitin.com.

    genesis_register_sidebar( array(
    	'id'          => 'home-optin',
    	'name'        => __( 'Home Optin', 'streamline' ),
    	'description' => __( 'This is the home opt-in form section.', 'streamline' ),
    ) );
    
    add_action( 'genesis_after_header', 'sk_optin_below_header' );
    
    function sk_optin_below_header() {
    	if ( is_home() && is_active_sidebar( 'home-optin' ) ) {
    		printf( '<div %s>', genesis_attr( 'horizontal-optin' ) );
    		genesis_structural_wrap( 'optin' );
    			genesis_widget_area( 'home-optin' );
    		genesis_structural_wrap( 'optin', 'close' );
    		echo '</div>';
    	}
    }
    

    I appreciate any help. Thanks


    http://www.getlevitin.com
    #102831

    neilgee
    Member
    Post count: 122

    try swapping
    is_home()

    with
    is_front_page()


    Neil Gee
    Coolest Guides

    #102832

    SimplyAA
    Participant
    Post count: 67

    Thanks. I actually had the wrong code in above message. I changed it to this and it worked:

    add_action( 'genesis_after_header', 'child_home_slider' );
    function child_home_slider() {
       if ( ! is_home() )
     return;
     genesis_widget_area( 'home-slider', array(
    			'before' => '<div id="home-slider"><div class="wrap">',
    			'after' => '</div></div>',
    		) );
    
    	}

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.