• 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

What's the opposite of 'is_active_sidebar'?

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 › What's the opposite of 'is_active_sidebar'?

This topic is: resolved

Tagged: 3 home middle widget areas, 3 widgets, front-page.php, Metro, php

  • This topic has 3 replies, 3 voices, and was last updated 10 years, 3 months ago by Victor Font.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • March 23, 2015 at 11:15 am #145342
    Joy G
    Member

    Hi,

    I have never done php before, but I am trying to make a 'home-middle-middle' widget area in Metro theme, for use with full screen content and no sidebar. This is what i have got so far for front-page.php, but I need to change the 'is_active_sidebar'. Would it be 'is_inactive_sidebar'? or 'is_not_active_sidebar' or 'inactive_sidebar'?

    //
    	elseif ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-middle-left' ) || is_active_sidebar( 'home-middle-middle' ) ||is_active_sidebar( 'home-middle-right' ) || is_active_sidebar( 'home-bottom' ) ) {
                    // Force content-sidebar layout setting
    		remove_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
    
    		// Add metro-pro-home body class
    		remove_filter( 'body_class', 'metro_body_class' );
    		function metro_body_class( $classes ) {
       			$classes[] = 'metro-pro-home';
      			return $classes;
    		}

    Does anyone know a link to a place on the internet where I can read how these actions / filters are meant to be written?

    Thanks!!

    March 23, 2015 at 12:58 pm #145360
    emasai
    Participant

    "is_active_sidebar" means, if there is something in the widget (home-top, etc) then follow the remaining instructions. If the widgets are empty do nothing.

    When you add your extra widget you also need to add it to the functions file.


    Need Website Customization or a Responsive CSS fix? Contact Me
    Lynne emasai.com

    March 23, 2015 at 5:25 pm #145381
    Joy G
    Member

    Thanks for your response emasai. The original front-page php, as I understand it, says "if certain sidebars are active force the default layout to be content/sidebar". However, if my middle-middle widget area is active that layout will not be possible, so I need to make some sort of conditional change like "If the middle-middle widget is active then default to full-width with no side bar"
    This is the original php. I have no idea about the last bit.

    
    	if ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-middle-left' ) || is_active_sidebar( 'home-middle-right' ) || is_active_sidebar( 'home-bottom' ) ) {
    
    		// Force content-sidebar layout setting
    		add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
    
    		// Add metro-pro-home body class
    		add_filter( 'body_class', 'metro_body_class' );
    		function metro_body_class( $classes ) {
       			$classes[] = 'metro-pro-home';
      			return $classes;
    		}

    I registered middle-middle in the functions file, and added it the CSS where the other two home-middle widgets are, The only thing I did not do is alter front-page php yet or specify a float in CSS. I figured that home-middle-right is right, left is left, so home-middle-middle doesn't need any float.

    I may well be out of my depth, but this is the only way i can learn this stuff!!

    March 24, 2015 at 12:12 pm #145509
    Victor Font
    Moderator

    Back to your original question, "What's the opposite of 'is_active_sidebar'?"

    The opposite is not is_active_sidebar, written in php as ! is_active_sidebar().


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Design Tips and Tricks’ 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

© 2025 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