This serves as nothing more than a note to self & anyone else that has ever told me that it’s not possible to include a CSS stylesheet from within a WordPress sidebar / footer widget: Within your widget init function add the line to enqueue the stylesheet: wp_enqueue_style('my-widgets-css', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)). '/widget.css'); for instance …. class DeviseCallBackWidget extends WP_Widget { function DeviseCallBackWidget() { $widget_ops = array('classname' => 'DeviseCallBackWidget', 'description' => 'Displays callback form on sidebar' ); $this->WP_Widget('DeviseCallBackWidget', 'Devise CallBack Widget', $widget_ops); wp_enqueue_style('widget', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)). '/widget.css'); } etc... …
↧