From 2d5dde96644c2af8df36a2fd918f67b1e3fe1d67 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 10 Dec 2017 21:15:55 +0100 Subject: [PATCH] Enabled AJAX update for widgets --- includes/class-wpliveticker2-widget.php | 23 ++-- includes/class-wpliveticker2.php | 134 ++++++++++++++++++------ scripts/wp-liveticker2.js | 52 ++++++--- views/widget-form.php | 4 +- 4 files changed, 157 insertions(+), 56 deletions(-) diff --git a/includes/class-wpliveticker2-widget.php b/includes/class-wpliveticker2-widget.php index 6403c73..53f3c94 100644 --- a/includes/class-wpliveticker2-widget.php +++ b/includes/class-wpliveticker2-widget.php @@ -34,6 +34,9 @@ class WPLiveticker2_Widget extends WP_Widget { * @param array $instance The settings for the particular instance of the widget. */ public function widget( $args, $instance ) { + // Notify WPLT2 class that widget is present. + WPLiveticker2::mark_widget_present(); + $instance = self::fill_options_with_defaults( $instance ); $before_widget = isset( $args['before_widget'] ) ? $args['before_widget'] : ''; $after_widget = isset( $args['after_widget'] ) ? $args['after_widget'] : ''; @@ -59,7 +62,14 @@ class WPLiveticker2_Widget extends WP_Widget { echo $before_title . esc_html( $title ) . $after_title; } - echo '