Title: Stylesheet enqueue method
Last modified: August 21, 2016

---

# Stylesheet enqueue method

 *  [FLOQ Design](https://wordpress.org/support/users/floq-design/)
 * (@floq-design)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/stylesheet-enqueue-method/)
 * Hi
    Thanks so much for this plugin – awesome work.
 * I’d like to suggest a mod that allows us designers with consciences about server
   requests, file sizes, bandwidth etc to implement this plugin’s styling as part
   of the main stylesheet, and not include the plugin styles file at all. SASS and
   LESS allow this very easily.
 * At the moment the stylesheet for the plugin is enqueued in a place that makes
   it impossible (or at least I’ve exhausted every method I could) to dequeue.
 * I don’t like the idea of overriding the styles – this increases the CSS file 
   size and as I say adds an unnecessary server call to the plugins’ stylesheet.
 * Having found a method to dequeue the WP Recent Comment styles, I looked into 
   the WP core files to see how it was setup (see LINE 642)
    [https://github.com/WordPress/WordPress/blob/master/wp-includes/default-widgets.php](https://github.com/WordPress/WordPress/blob/master/wp-includes/default-widgets.php)
 * As you can see the stylesheet is enqueued as part of the widget constructor.
 * So my mod suggestion is to use the same method as so:
 *     ```
       function BraTwitterWidget() {
       		$widget_options = array(
       		'classname'        =>        'bra-twitter-widget',
       		'description'     =>        'Showing tweets of the user. New Twitter API v1.1'
       		);
   
       		parent::WP_Widget('bra_twitter_widget', 'Brankic Twitter Widget', $widget_options);
   
       		$root = plugin_dir_url( __FILE__ );
       		if ( is_active_widget(false, false, $this->id_base) )
       			wp_enqueue_style("bra_twitter", $root."bra_twitter_widget.css");
       	}
       ```
   
 * Now I can easily call:
 *     ```
       wp_dequeue_style( 'bra_twitter' );
       ```
   
 * via an action as such:
 *     ```
       add_action( 'wp_enqueue_scripts', 'scripts', 100 );
       ```
   
 * Sorry for the long winded explanation.
 * Thanks.
 * [https://wordpress.org/plugins/brankic-twitter-widget/](https://wordpress.org/plugins/brankic-twitter-widget/)

The topic ‘Stylesheet enqueue method’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/brankic-twitter-widget_4c6971.svg)
 * [Brankic Twitter Widget](https://wordpress.org/plugins/brankic-twitter-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/brankic-twitter-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/brankic-twitter-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/brankic-twitter-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/brankic-twitter-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/brankic-twitter-widget/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [FLOQ Design](https://wordpress.org/support/users/floq-design/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/stylesheet-enqueue-method/)
 * Status: not resolved