Print fronted styles only when available
This commit is contained in:
@@ -15,8 +15,7 @@ class SP_Frontend_Scripts {
|
|||||||
*/
|
*/
|
||||||
public function __construct () {
|
public function __construct () {
|
||||||
add_action( 'wp_enqueue_scripts', array( $this, 'load_scripts' ) );
|
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, 'check_jquery' ), 25 );
|
||||||
add_action( 'wp_print_scripts', array( $this, 'custom_css' ), 30 );;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,9 +53,11 @@ class SP_Frontend_Scripts {
|
|||||||
// CSS Styles
|
// CSS Styles
|
||||||
$enqueue_styles = $this->get_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 )
|
foreach ( $enqueue_styles as $handle => $args )
|
||||||
wp_enqueue_style( $handle, $args['src'], $args['deps'], $args['version'], $args['media'] );
|
wp_enqueue_style( $handle, $args['src'], $args['deps'], $args['version'], $args['media'] );
|
||||||
|
endif;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user