Register styles in main plugin

Enqueue styles only if needed
This commit is contained in:
Justin Foell
2014-11-04 21:09:12 -06:00
parent 18d8897ee9
commit 353ee5ecb0
5 changed files with 15 additions and 27 deletions
+1 -10
View File
@@ -5,13 +5,11 @@ class WPStrava_RideShortcode {
static function init() {
add_shortcode('ride', array(__CLASS__, 'handler'));
add_action('init', array(__CLASS__, 'registerScripts'));
add_action('wp_footer', array(__CLASS__, 'printScripts'));
}
// Shortcode handler function
// [ride id=id som=metric efforts=false threshold=5 map-width="100%" map-height="400px"] tag
// [ride id=id som=metric map_width="100%" map_height="400px"]
function handler($atts) {
self::$add_script = true;
@@ -72,13 +70,6 @@ class WPStrava_RideShortcode {
}
} // handler
static function registerScripts() {
wp_register_style('wp-strava-style', WPSTRAVA_PLUGIN_URL . 'css/wp-strava.css' );
//wp_register_script('wp-strava-script', WPSTRAVA_PLUGIN_URL . 'js/wp-strava.js', array( 'jquery' ), '1.0', true);
//wp_register_script('google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
}
static function printScripts() {
if (self::$add_script) {
wp_enqueue_style('wp-strava-style');