Suggestion: Include custom CSS from template dir if available
-
I have been using the Popular Widget plugin in one of my projects. In that project I had to customize the default CSS. So I modified the functions.php at around line 52 like this:
if( ! is_admin() || is_active_widget( false, false, $this->id_base, true ) ) { if ( file_exists( get_template_directory().'/pop-widget.css' ) ) { wp_enqueue_style( 'popular-widget', get_template_directory_uri() . '/pop-widget.css', NULL, $this->version ); } else { wp_enqueue_style( 'popular-widget', POPWIDGET_URL . '_css/pop-widget.css', NULL, $this->version ); } wp_enqueue_script( 'popular-widget', POPWIDGET_URL . '_js/pop-widget.js', array('jquery'), $this->version, true ); }
It checks for a pop-widget.css in the theme directory. If not found, it includes the pop-widget.css from plugin _css directory.
This way, when the plugin is updated, the CSS should stay there.
Please include it in the next release of the plugin.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Suggestion: Include custom CSS from template dir if available’ is closed to new replies.