Skip to content

Commit

Permalink
Merge pull request #313 from mailjet/Widget-scripts-dependency
Browse files Browse the repository at this point in the history
Dont add scripts if widget not added
  • Loading branch information
Pavlico authored Sep 16, 2021
2 parents 0b2822d + 2ce4401 commit 3ee2d4e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/widget/WP_Mailjet_Subscribe_Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ public function __construct()
// Register site styles and scripts
add_action('admin_enqueue_scripts', array($this, 'register_widget_scripts'));

add_action('wp_enqueue_scripts', array($this, 'register_widget_front_styles'));
add_action('wp_enqueue_scripts', array($this, 'register_widget_front_scripts'));
if (is_active_widget(false, false, $this->id_base)) {
add_action('wp_enqueue_scripts', array($this, 'register_widget_front_styles'));
add_action('wp_enqueue_scripts', array($this, 'register_widget_front_scripts'));
}

// Refreshing the widget's cached output with each new post
add_action('save_post', array($this, 'flush_widget_cache'));
Expand Down

0 comments on commit 3ee2d4e

Please sign in to comment.