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
-12
View File
@@ -37,15 +37,3 @@ if( file_exists( WPSTRAVA_PLUGIN_DIR . 'lang/' . get_locale() . '.mo' ) ) {
require_once WPSTRAVA_PLUGIN_DIR . 'lib/Strava.class.php';
$wpstrava = WPStrava::get_instance();
//@TODO only load these when needed using is_active_widget()
function wpstrava_load_scripts_and_styles() {
// Register a personalized stylesheet
wp_register_style('wp-strava-style', WPSTRAVA_PLUGIN_URL . 'css/wp-strava.css' );
wp_enqueue_style('wp-strava');
// Load required javascript libraries
wp_enqueue_script('jquery');
//wp_enqueue_script('google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
}
add_action('wp_enqueue_script', 'wpstrava_load_scripts_and_styles');