• 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

How to Conditionally hide this slider?

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 › How to Conditionally hide this slider?

This topic is: not resolved

Tagged: Conditionally, hide, php, slider

  • This topic has 2 replies, 2 voices, and was last updated 9 years, 2 months ago by designslucid.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • July 17, 2014 at 9:35 am #114662
    designslucid
    Member

    What is the necessary addition of php code to only have this widget area appear on the homepage? I'm probably just putting it in the wrong place, but I have tried if (!is_home() ) and if (is_home() )

    Here's what I have currently:

    /** Add the welcome text section */
    add_action( 'genesis_before_content_sidebar_wrap', 'custom_welcome_text' );
    function custom_welcome_text() {
    genesis_widget_area( 'welcome-text', array(
    'before' => '<div class="welcome-text widget-area">',
    'after' => '</div>',
    ) );
    }

    If anyone can help me, it would be greatly appreciated!

    http://www.brandonbattles.com
    July 17, 2014 at 9:50 am #114664
    Genesis Developer
    Member

    try this once

    /** Add the welcome text section */
    add_action( 'genesis_before_content_sidebar_wrap', 'custom_welcome_text' );
    function custom_welcome_text() {
      if( is_home() ):
            genesis_widget_area( 'welcome-text', array(
                 'before' => '<div class="welcome-text widget-area">',
                 'after' => '</div>',
           ) );
      endif;
    }

    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    July 17, 2014 at 9:56 am #114665
    designslucid
    Member

    Thanks for such a quick reply genwrock. I tried your code as is and it did not show the slider on any pages, same thing that had been happening with mine. BUT - before I saw your reply I tried this below and it worked. Also, I modified is_home to is_front_page on your code and it worked as well!

    Appreciate the help and I hope this helps someone else in the future as well. I tried searching this out before I posted and couldn't find a solution that worked. Thanks again!!!

    /** Add the welcome text section */
    add_action( 'genesis_before_content_sidebar_wrap', 'custom_welcome_text' );
    function custom_welcome_text() { if ( is_front_page() ){ 
    genesis_widget_area( 'welcome-text', array(
    'before' => '<div class="welcome-text widget-area">',
    'after' => '</div>',
    ) );
    }
    }
  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ is closed to new topics and 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