CSS conditional load
This commit is contained in:
@ -23,6 +23,8 @@ class Juxtapose {
|
|||||||
|
|
||||||
// TODO: Sanitize attributes
|
// TODO: Sanitize attributes
|
||||||
static function shortcode( $atts ) {
|
static function shortcode( $atts ) {
|
||||||
|
self::$shortcode_rendered = true;
|
||||||
|
|
||||||
wp_enqueue_script('juxtapose');
|
wp_enqueue_script('juxtapose');
|
||||||
|
|
||||||
$a = shortcode_atts( array(
|
$a = shortcode_atts( array(
|
||||||
@ -60,7 +62,9 @@ EOT;
|
|||||||
// Yeah i know, <link> inside <body> is not valid HTML.
|
// Yeah i know, <link> inside <body> is not valid HTML.
|
||||||
// But i don't want to load this css when there's not need to.
|
// But i don't want to load this css when there's not need to.
|
||||||
// SUE ME.
|
// SUE ME.
|
||||||
echo '<link rel="stylesheet" href="//s3.amazonaws.com/cdn.knightlab.com/libs/juxtapose/latest/css/juxtapose.css">';
|
if(self::$shortcode_rendered){
|
||||||
|
echo '<link rel="stylesheet" href="//s3.amazonaws.com/cdn.knightlab.com/libs/juxtapose/latest/css/juxtapose.css">';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user