How to only load scripts if WordPress Widget is Active

26 Apr 2012 By Code Snippets 2 Comments

Have you ever wanted to load certain scripts depending on whether a widget is being displayed? Using the WordPress is_widget_active we can run a check to check if the widget is being displayed and load the relevant scripts.