我想在侧栏中加载小部件时加载一个特殊的Javascript文件。我应该把我的wp_enqueue_script(...)
线
class controller_widget extends WP_Widget {
function controller_widget() {
$this->color = "red";
$this->dir = plugin_dir_url(__FILE__);
$widget_ops = array(\'classname\' => \'controller_widget\', \'description\' => __(\'Benutzerfreundlicher Controller zur eingrenzung von Objekten\'));
$control_ops = array(\'width\' => 350, \'height\' => 400);
$this->WP_Widget(\'controller_widget\', __(\'Controller\'), $widget_ops, $control_ops);
// At the moment I load the code here, but I want to proof that it is just loaded when the widget really is shown in the sidebar.
}
}
function widget( $args, $instance ) {...}
}
谢谢大家!