I need to load a separate js file into a widget and just can't get it to work. So far I have
if ( is_active_widget( false, false, $this->id_base, true ) ) {
function tab_widget_scripts() {
wp_register_script( 'tabs', plugins_url( 'tabs.js', __FILE__ ), array(), false, true );
wp_enqueue_script( 'tabs.js' );
}
}
in my function __construct()
and then
do_action( 'wp_print_footer_scripts', 'tab_widget_scripts' );
inside public function widget( $args, $instance )
. Can anyone tell me what I'm doing wrong please?