diff --git a/lib/WPStrava.php b/lib/WPStrava.php index e323aca..b5a94d7 100644 --- a/lib/WPStrava.php +++ b/lib/WPStrava.php @@ -14,11 +14,13 @@ private function __construct() { if ( is_admin() ) { $this->settings->hook(); } else { + add_action( 'init', array( $this, 'register_shortcodes') ); add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); } // Register widgets. add_action( 'widgets_init', array( $this, 'register_widgets' ) ); + } public static function get_instance() { @@ -82,4 +84,11 @@ public function register_widgets() { register_widget( 'WPStrava_LatestActivitiesWidget' ); register_widget( 'WPStrava_LatestMapWidget' ); } + + public function register_shortcodes() { + add_shortcode( 'ride', array( 'WPStrava_ActivityShortcode', 'handler' ) ); // @deprecated 1.1 + add_shortcode( 'activity', array( 'WPStrava_ActivityShortcode', 'handler' ) ); + add_shortcode( 'activities', array( 'WPStrava_LatestActivitiesShortcode', 'handler' ) ); + add_shortcode( 'route', array( 'WPStrava_RouteShortcode', 'handler' ) ); + } } diff --git a/lib/WPStrava/ActivityShortcode.php b/lib/WPStrava/ActivityShortcode.php index fd50c89..8ceba13 100644 --- a/lib/WPStrava/ActivityShortcode.php +++ b/lib/WPStrava/ActivityShortcode.php @@ -4,8 +4,6 @@ class WPStrava_ActivityShortcode { private static $add_script; public static function init() { - add_shortcode( 'ride', array( __CLASS__, 'handler' ) ); // @deprecated 1.1 - add_shortcode( 'activity', array( __CLASS__, 'handler' ) ); add_action( 'wp_footer', array( __CLASS__, 'print_scripts' ) ); } diff --git a/lib/WPStrava/LatestActivities.php b/lib/WPStrava/LatestActivities.php index 683ab97..ded9150 100644 --- a/lib/WPStrava/LatestActivities.php +++ b/lib/WPStrava/LatestActivities.php @@ -23,14 +23,22 @@ public static function get_activities_html( $args ) { $response = "