From 086a8f1955e5aa90357551b4010fe25894c06a27 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Tue, 15 Apr 2014 19:00:39 +1000 Subject: [PATCH] Print fronted styles only when available --- includes/class-sp-frontend-scripts.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/class-sp-frontend-scripts.php b/includes/class-sp-frontend-scripts.php index 6780a895..748a4d8b 100644 --- a/includes/class-sp-frontend-scripts.php +++ b/includes/class-sp-frontend-scripts.php @@ -15,8 +15,7 @@ class SP_Frontend_Scripts { */ public function __construct () { add_action( 'wp_enqueue_scripts', array( $this, 'load_scripts' ) ); - add_action( 'wp_print_scripts', array( $this, 'check_jquery' ), 25 );; - add_action( 'wp_print_scripts', array( $this, 'custom_css' ), 30 );; + add_action( 'wp_print_scripts', array( $this, 'check_jquery' ), 25 ); } /** @@ -54,9 +53,11 @@ class SP_Frontend_Scripts { // CSS Styles $enqueue_styles = $this->get_styles(); - if ( $enqueue_styles ) + if ( $enqueue_styles ): + add_action( 'wp_print_scripts', array( $this, 'custom_css' ), 30 ); foreach ( $enqueue_styles as $handle => $args ) wp_enqueue_style( $handle, $args['src'], $args['deps'], $args['version'], $args['media'] ); + endif; } /**