• 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

Add Action conditional statement Before Content Sidebar Wrap

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 › Design Tips and Tricks › Add Action conditional statement Before Content Sidebar Wrap

This topic is: resolved

Tagged: Add Action, conditional statement, genesis_before_content_sidebar_wrap, lifestyle Pro, slider

  • This topic has 2 replies, 2 voices, and was last updated 8 years, 5 months ago by ClintN.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • April 23, 2015 at 5:10 am #148886
    ClintN
    Participant

    I am looking to ad a slider to the Lifestyle Pro theme to the Before Content Sidebar Wrap hook, on the homepage only.

    In functions.php I have tried many attempts at an if statement with add action i.e.

    //* Add support for full-width slider
    add_action( 'genesis_before_content_sidebar_wrap', 'add_genesis_widget_area' );
    if ( is_home() function add_genesis_widget_area() ) {
                    genesis_widget_area( 'genesis_before_content_sidebar_wrap', array(
    		'before' => '<div class="widget.genesis_responsive_slider">',
    		'after'  => '</div>',
        ) );
    
    }
    //* Add support for full-width slider
    add_action( 'genesis_before_content_sidebar_wrap', 'add_genesis_widget_area' );
    if ( is_home() ) function add_genesis_widget_area() {
                    genesis_widget_area( 'genesis_before_content_sidebar_wrap', array(
    		'before' => '<div class="widget.genesis_responsive_slider">',
    		'after'  => '</div>',
        ) );
    
    }

    Am I on the right path?

    otherwise I have below but it puts the slider on every page:

    //* Add support for full-width slider
    add_action( 'genesis_before_content_sidebar_wrap', 'add_genesis_widget_area' );
    function add_genesis_widget_area() {
                    genesis_widget_area( 'genesis_before_content_sidebar_wrap', array(
    		'before' => '<div class="widget.genesis_responsive_slider">',
    		'after'  => '</div>',
        ) );
    
    }

    Many thanks in advance

    http://icrush.com.au/
    April 23, 2015 at 5:51 am #148887
    Brad Dalton
    Participant

    Which slider?

    Add the conditional tag after the function

    if ( is_front_page())
    

    Like this;

    genesis_register_sidebar( array(
    	'id'          => 'slider',
    	'name'        => __( 'Slider', 'genesis' ),
    	'description' => __( 'This is the slider widget area.', 'genesis' ),
    ) );
    
    add_action( 'genesis_before_content_sidebar_wrap', 'slider_widget' );
    function slider_widget() {
    
    	if ( ! is_front_page() || get_query_var( 'paged' ) >= 2 )
    		return;
    
    	genesis_widget_area( 'slider', array(
    		'before' => '<div class="slider" class="widget-area">',
    		'after'  => '</div>',
    	) );
    
    }
    

    Tutorials for StudioPress Themes & WooCommerce.

    April 23, 2015 at 4:00 pm #148943
    ClintN
    Participant

    Thanks Brad,
    It's the good old Genesis Responsive Slider.
    I will give above a go ASAP

    Thanks again 🙂

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Add Action conditional statement Before Content Sidebar Wrap’ 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