Make WordPress Core


Ignore:
Timestamp:
03/21/2016 09:58:02 PM (10 years ago)
Author:
westonruter
Message:

Customize: Require opt-in for selective refresh of widgets.

  • Introduces customize-selective-refresh-widgets theme support feature and adds to themes.
  • Introduces customize_selective_refresh arg for WP_Widget::$widget_options and adds to all core widgets.
  • Remove selective_refresh from being a component that can be removed via customize_loaded_components filter.
  • Add WP_Customize_Widgets::get_selective_refreshable_widgets() and WP_Customize_Widgets::is_widget_selective_refreshable().
  • Fix default selector for Partial instances.
  • Implement and improve Masronry sidebar refresh logic in Twenty Thirteen and Twenty Fourteen, including preservation of initial widget position after refresh.
  • Re-initialize ME.js when refreshing Twenty_Fourteen_Ephemera_Widget.

See #27355.
Fixes #35855.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-recent-comments.php

    r34622 r37040  
    2424         */
    2525        public function __construct() {
    26                 $widget_ops = array('classname' => 'widget_recent_comments', 'description' => __( 'Your site’s most recent comments.' ) );
    27                 parent::__construct('recent-comments', __('Recent Comments'), $widget_ops);
     26                $widget_ops = array(
     27                        'classname' => 'widget_recent_comments',
     28                        'description' => __( 'Your site’s most recent comments.' ),
     29                        'customize_selective_refresh' => true,
     30                );
     31                parent::__construct( 'recent-comments', __( 'Recent Comments' ), $widget_ops );
    2832                $this->alt_option_name = 'widget_recent_comments';
    2933
    30                 if ( is_active_widget(false, false, $this->id_base) )
    31                         add_action( 'wp_head', array($this, 'recent_comments_style') );
     34                if ( is_active_widget( false, false, $this->id_base ) || is_customize_preview() ) {
     35                        add_action( 'wp_head', array( $this, 'recent_comments_style' ) );
     36                }
    3237        }
    3338
Note: See TracChangeset for help on using the changeset viewer.