[wp-trac] [WordPress Trac] #34042: Conditional widget areas in Customizer

WordPress Trac noreply at wordpress.org
Sun Sep 27 10:44:19 UTC 2015


#34042: Conditional widget areas in Customizer
-------------------------+-----------------------------
 Reporter:  Looimaster   |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Customize    |    Version:  4.3.1
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 I would like to show a widget area in Appearance > Widgets and in
 Appearance > Customize only when the user enables the component which
 requires it in Customizer. The code below (1) doesn't dynamically add the
 widget area in Appearance > Customize if I adjust another option.
 Furthermore, (2) it doesn't display this conditional sidebar in the live
 preview:

 {{{
 if ( get_theme_mod( 'enable_side_panel' ) ) {
         register_sidebar( array(
                 'name'          => __( 'Some Widget Area', 'sometheme' ),
                 'id'            => 'sidebar-1',
                 'description'   => '',
                 'class'         => '',
                 'before_widget' => '<aside id="%1$s" class="widget
 %2$s">',
                 'after_widget'  => '</aside>',
                 'before_title'  => '<h2 class="widget-title">',
                 'after_title'   => '</h2>'
         ) );
 }
 }}}

 Furthermore, it would be nice to show all widget areas in Customizer (like
 it is in Appearance > Customize) regardless if they are currently visible
 on the page or not.

 Reasons:
 1) I constantly wonder how many options am I missing if they are not shown
 all at once.
 2) To make sure that I customized everything I have to open my 10 subpages
 on the website which takes a lot of time and review what Customizer
 options have appeared on each page.
 3) I'm never able to compare for example "Shop sidebar" from WooCommerce,
 "Page sidebar" and "Footer sidebar" to see if I reuse any widgets.
 4) If I'm on static homepage which doesn't have sidebar then it's rather
 obvious to me that "Blog sidebar" is not there and I know where is it and
 requiring me to click on the "Blog" link to customize that sidebar is one
 step too many.

 Maybe in some themes and plugins it's a good idea to show widget areas
 conditionally but in most it would be better to show all available options
 at all times.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34042>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list