Community Forums › Forums › Archived Forums › Design Tips and Tricks › What's the opposite of 'is_active_sidebar'?
Tagged: 3 home middle widget areas, 3 widgets, front-page.php, Metro, php
- This topic has 3 replies, 3 voices, and was last updated 9 years, 10 months ago by
Victor Font.
-
AuthorPosts
-
March 23, 2015 at 11:15 am #145342
Joy G
MemberHi,
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 #145360emasai
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.comMarch 23, 2015 at 5:25 pm #145381Joy G
MemberThanks 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 #145509Victor Font
ModeratorBack 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? -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.