Update for stylesheet call
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 25 Apr 2016 20:49:08 +0000 (16:49 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 25 Apr 2016 20:49:08 +0000 (16:49 -0400)
call only when shortcode runs

controllers/front.php
index.php

index 3519b1f..b955b8a 100644 (file)
@@ -20,7 +20,6 @@ class glm_coupon_front
         add_shortcode('glmcoupons', array($this, 'glm_coupon_shortcode'));
         $this->viewDir = $this->pluginDirName . self::FORM_VIEW_DIR;
         $this->frontViewDir = $this->viewDir . '/front';
-        add_action('wp_enqueue_scripts', array($this, 'load_stylesheet'));
         add_action('query_vars', array($this, 'glm_coupon_query_vars'));
         add_action('wp', array($this, 'glm_coupon_parse_request'));
     }
@@ -45,6 +44,14 @@ class glm_coupon_front
             array('category' => '-1'), $atts, 'glmcoupons')
         );
 
+        wp_enqueue_style(
+            'glm-coupons',
+            plugins_url('glm-coupons/css/front/coupons.css' , $this->pluginDirName),
+            array(),
+            '0.0.1',
+            'all'
+        );
+
         ob_start();
         $this->list_coupons();
         $output = ob_get_contents();
@@ -59,17 +66,6 @@ class glm_coupon_front
         // use smarty template to output the form
     }
 
-    public function load_stylesheet()
-    {
-        wp_enqueue_style(
-            'glm-coupons',
-            plugins_url('glm-coupons/css/front/coupons.css' , $this->pluginDirName),
-            array(),
-            '0.0.1',
-            'all'
-        );
-    }
-
     public function list_coupons($print = false)
     {
         global $wpdb, $wp;
index 1adea54..3295a89 100644 (file)
--- a/index.php
+++ b/index.php
@@ -2,7 +2,7 @@
 /**
  * Plugin Name: Gaslight Media Coupons
  * Description: Coupon Application for Gaslight Media Clients.
- * Version: 1.1.4
+ * Version: 1.1.5
  * Author: Steve Sutton
  * Author URI: http://www.gaslightmedia.com
  * License: All right reserved