Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/dan-bailey/strava-blocks/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
WordPress Gutenberg blocks for displaying Strava activities and data on your website.
Features
- Recent Activity Block: Display your latest Strava activity with map thumbnail and stats
- OAuth Integration: Secure connection to your Strava account
- Customizable Display: Adjustable titles and alignment options
- Interactive Maps: Click-through to view full activity on Strava
- Responsive Design: Works on desktop and mobile devices
Installation
-
Download or clone this plugin to your WordPress plugins directory:
/wp-content/plugins/strava/ -
Build the assets (requires Node.js):
cd /path/to/wp-content/plugins/strava npm install npm run build -
Activate the plugin in WordPress Admin → Plugins
Setup
1. Create a Strava API Application
- Go to https://www.strava.com/settings/api
- Click "Create App"
- Fill in the required information:
- Application Name: Your app name
- Category: Choose appropriate category
- Club: Leave blank unless required
- Website: Your website URL
- Authorization Callback Domain: Your domain (e.g.,
yourdomain.com)
- Click "Create"
- Copy your Client ID and Client Secret
2. Configure the Plugin
- In WordPress Admin, go to Settings → Strava
- Enter your Client ID and Client Secret from step 1
- (Optional) Add a Google Maps API Key for better map thumbnails
- Click "Save Changes"
- Click "Connect to Strava" to authorize the connection
- You'll be redirected to Strava to approve access
- After approval, you'll return to WordPress with a connected status
3. Google Maps API (Optional)
For enhanced map thumbnails, you can add a Google Maps API key:
- Go to Google Cloud Console
- Create a project or select existing one
- Enable the Maps Static API
- Create credentials (API Key)
- Add the API key in Settings → Strava → Google Maps API Key
Without this key, the plugin will show stylized SVG map placeholders.
Usage
Recent Activity Block
- Create or edit a post/page in WordPress
- Click "Add Block" (+) in Gutenberg
- Search for "Recent Strava Activity"
- Add the block to your content
Block Options:
- Title: Customize the block heading (default: "Recent Activity")
- Alignment: Left, Center, or Right alignment
- Automatic Loading: Fetches your most recent Strava activity
The block displays:
- Activity name and type (Run, Ride, etc.)
- Date of activity
- Distance, time, and elevation gain
- Map thumbnail (clickable link to Strava)
Block Controls
- Toolbar: Alignment options (left/center/right)
- Inspector Panel: Title customization and alignment settings
- Auto-refresh: Block data updates when you add new Strava activities
Troubleshooting
"Not connected" or "API Error"
- Verify your Client ID and Client Secret are correct
- Ensure your WordPress site domain matches the Strava app callback domain
- Try disconnecting and reconnecting your Strava account
"No recent activities found"
- Make sure you have recent activities on Strava
- Check that your activities are not set to "Only You" privacy
- Token may need refreshing - try reconnecting
Block not appearing
- Ensure the plugin is activated
- Check browser console for JavaScript errors
- Verify assets were built correctly (
npm run build)
Map thumbnails not showing
- Without Google Maps API: Shows SVG placeholders (normal behavior)
- With Google Maps API: Verify your API key has Static Maps API enabled
- Check that the API key has proper permissions and quotas
Development
Building Assets
# Install dependencies
npm install
# Development build (watch mode)
npm run dev
# Production build
npm run build
File Structure
strava/
├── strava-blocks.php # Main plugin file
├── includes/
│ ├── strava-api.php # Strava API wrapper
│ └── rest-api.php # WordPress REST endpoints
├── blocks/
│ └── recent-activity/ # Gutenberg block files
├── build/ # Compiled assets
└── README.md # This file
API Endpoints
The plugin exposes these REST API endpoints:
GET /wp-json/strava-blocks/v1/activities/recent- Get recent activitiesGET /wp-json/strava-blocks/v1/activities/{id}- Get specific activityGET /wp-json/strava-blocks/v1/athlete- Get athlete profileGET /wp-json/strava-blocks/v1/connection-status- Check connection status
Requirements
- WordPress 5.0+ with Gutenberg
- PHP 7.4+
- Node.js 16+ (for building assets)
- Active Strava account
- Strava API application
License
GPL-2.0-or-later
Support
For issues and questions, please check:
- This README file
- WordPress admin Settings → Strava for connection status
- Browser console for JavaScript errors
- Strava API documentation at developers.strava.com
Changelog
1.0.0
- Initial release
- Recent Activity Gutenberg block
- OAuth integration with Strava
- Map thumbnail support
- Responsive design