[wp-trac] [WordPress Trac] #35855: Let selective refresh component be required but be opt-in for sidebars/widgets (for now)
WordPress Trac
noreply at wordpress.org
Thu Mar 17 19:59:26 UTC 2016
#35855: Let selective refresh component be required but be opt-in for
sidebars/widgets (for now)
----------------------------+--------------------------
Reporter: DrewAPicture | Owner: westonruter
Type: task (blessed) | Status: accepted
Priority: normal | Milestone: 4.5
Component: Customize | Version: trunk
Severity: blocker | Resolution:
Keywords: has-patch | Focuses:
----------------------------+--------------------------
Comment (by westonruter):
There is a certain elegance to letting the theme opt-in be an argument on
`register_sidebar()` as it would be more closely aligned with how a
`WP_Widget` is proposed to be defined with support:
{{{#!diff
class WP_Widget_Pages extends WP_Widget {
public function __construct() {
$widget_ops = array(
'classname' => 'widget_pages',
'description' => __( 'A list of your site’s
Pages.' ),
+ 'customize_selective_refresh' => true,
);
parent::__construct( 'pages', __('Pages'), $widget_ops );
}
}
...
register_sidebar( array(
'name' => __( 'Widget Area', 'twentyfifteen' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your
sidebar.', 'twentyfifteen' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
+ 'customize_selective_refresh' => true,
) );
}}}
So there is this option using `register_sidebar()`, and then the option
for using `add_theme_support()`:
{{{
add_theme_support( 'customize-selective-refresh-widgets' );
}}}
Although, the identifier `customize-selective-refresh-widgets` vs
`customize_selective_refresh` isn't set in stone either.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35855#comment:41>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list