From c3c8b1bfa8b567c21f9ae55b7b73b40f2a16c4ab Mon Sep 17 00:00:00 2001 From: Federico Cingolani Date: Tue, 31 Mar 2015 01:57:52 -0300 Subject: [PATCH] CSS conditional load --- juxtapose.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/juxtapose.php b/juxtapose.php index 79709b4..978c010 100644 --- a/juxtapose.php +++ b/juxtapose.php @@ -23,6 +23,8 @@ class Juxtapose { // TODO: Sanitize attributes static function shortcode( $atts ) { + self::$shortcode_rendered = true; + wp_enqueue_script('juxtapose'); $a = shortcode_atts( array( @@ -60,7 +62,9 @@ EOT; // Yeah i know, inside is not valid HTML. // But i don't want to load this css when there's not need to. // SUE ME. - echo ''; + if(self::$shortcode_rendered){ + echo ''; + } } }