• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Widget is displaying on all pages

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Widget is displaying on all pages

This topic is: resolved

Tagged: streamline pro, widget

  • This topic has 2 replies, 2 voices, and was last updated 9 years, 7 months ago by SimplyAA.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • April 28, 2014 at 5:31 pm #102830
    SimplyAA
    Member

    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


    Angela

    http://www.getlevitin.com
    April 28, 2014 at 6:15 pm #102831
    neilgee
    Member

    try swapping
    is_home()

    with
    is_front_page()


    Neil Gee
    WP Beaches
    Coolest Guides

    April 28, 2014 at 6:19 pm #102832
    SimplyAA
    Member

    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>',
    		) );
    
    	}

    Angela

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Widget is displaying on all pages’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble