diff options
Diffstat (limited to 'plugins/jetpack/modules/widgets/wordpress-post-widget.php')
-rw-r--r-- | plugins/jetpack/modules/widgets/wordpress-post-widget.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/plugins/jetpack/modules/widgets/wordpress-post-widget.php b/plugins/jetpack/modules/widgets/wordpress-post-widget.php index f06753bc..33cb528d 100644 --- a/plugins/jetpack/modules/widgets/wordpress-post-widget.php +++ b/plugins/jetpack/modules/widgets/wordpress-post-widget.php @@ -145,8 +145,13 @@ class Jetpack_Display_Posts_Widget extends WP_Widget { apply_filters( 'jetpack_widget_name', __( 'Display WordPress Posts', 'jetpack' ) ), array( 'description' => __( 'Displays a list of recent posts from another WordPress.com or Jetpack-enabled blog.', 'jetpack' ), + 'customize_selective_refresh' => true, ) ); + + if ( is_customize_preview() ) { + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); + } } /** @@ -727,7 +732,8 @@ class Jetpack_Display_Posts_Widget extends WP_Widget { /** This filter is documented in core/src/wp-includes/default-widgets.php */ $title = apply_filters( 'widget_title', $instance['title'] ); - wp_enqueue_style( 'jetpack_display_posts_widget', plugins_url( 'wordpress-post-widget/style.css', __FILE__ ) ); + // Enqueue front end assets. + $this->enqueue_scripts(); echo $args['before_widget']; @@ -883,6 +889,15 @@ class Jetpack_Display_Posts_Widget extends WP_Widget { } /** + * Enqueue CSS and JavaScript. + * + * @since 4.0.0 + */ + public function enqueue_scripts() { + wp_enqueue_style( 'jetpack_display_posts_widget', plugins_url( 'wordpress-post-widget/style.css', __FILE__ ) ); + } + + /** * Display the widget administration form. * * @param array $instance Widget instance configuration. |