This plugin will help you to display information from your Strava account, Strava is an excellent site for cyclist to track your performance, the plugin is divided in three pieces:
- A widget to get the latest rides of any athlete or club.
- A short code “ride” to allow you to display more information about a specific ride and a map with the trace of the ride. NOTE: The Strava API states that the tokens they provide do not expire, but they indeed expire so the shorcode functionality to display the map will stop working after your token expire, the only workaround is to login into your admin pages and enter your password again to generate a new token.
- Last a small configuration page to obtain your Strava token to allow you to pull details of your rides.
Requirements
- This plugin is written completely in objects, so it needs that you run your wordpress installation on PHP 5.3+.
- I’ve tested this plugin with the latest wordpress 3.1+, please report any issue.
- For this plugin to work, you need to have fun riding and use the excellent Strava service.
Installation
1. Download latest plugin version and unzipped it into your wordpress plugins folder.
2. Access to your Settings -> WP Strava page and put your Strava email and password (your password won’t be saved and will be sent to Strava using https) to get your token.
3. Configure your widget settings accessing Appearance -> Widgets (the widget name is Strava Latest Rides).
4. Use the “ride” shortcode on any post or page.
Changelog
- Added configurations for metric/english system both on the widget and the shortcode options, for the shortcode use the option som=”english”.
- Initial Release
Configuration
The “ride” shortcode accept four arguments:
- id: required. It is the ride identifier.
- map_width: optional. This is the with of the map that will be shown in the post or page, and basically is a css property so, it accept any css with value, default value is “100%”.
- map_height: optional. This is the height of the map that will be shown in the post or page, and basically is a css property so, it accept any css height value, default value is “400px”.
- threshold: optional. It’s a parameter to the Strava API to discard “uninteresting” points in the map in the “threshold” value in meters, default value is “0″.
If you would like to customize the way the html output work, you need to edit the css file included in the plugin main directory css/wp-strava.css.
Shortcode Examples
Simple:
[ride id=912928]
With all options:
[ride id=912928 map_width="500px" map_height="200px" threshold="15"]
Screenshots
- The plugin is prepared for multilingual support, just need to create and include the .po file to add more translations, now works just in english.
You can contact me for any issues with the plugin. Have fun riding!




[...] they rely on iframes which WordPress will strip out of blog posts. Thankfully I found an excellent plugin which solves that (see the previous post for examples of it in use) The plugin makes use of the [...]
Hi, As a new Strava user I found your plugin to be excellent. I did however hack it to display distance in miles and speed in miles per hour rather than KM and KM/H. It would be nice to make this a configurable option on the widget settings.
Great work!
Hi Adrian,
Thank you for the feedback, I will make metric or english system as an option on the widget, if you have the changes you made, send those to me and I will happily added them to the plugin.
Carlos
I get this error when i try to activate the plugin:
‘Parse error: syntax error, unexpected T_STRING in….Line 2′
Hi Chadd,
I think that error is cause by the fact that you are not running your blog in php 5.3+.
That worked, thanks for the assistance. Looking forward to using this plugin.
Did you include the english system option in the widget? (i can’t find it if so), or do i need to hack it?
@Chadd,
The plugin is two pieces the widget and the shortcode, the english system option is already implemented on the widget, and the shortcode is missing once I finished the shortcode piece will publish a new version hopefully during this weekend.
Awesome, thanks!
Great plug in, loving it.
Ok, so i’m a dumbass. How do you get the English system to display in the widget?
Parse error: syntax error, unexpected T_STRING in /home/content/r/e/m/remy19233490/html/wp-content/plugins/wp-strava/wp-strava.php on line 2
help me !
@raybaud, Look at the comments, that’s probably because your blog is not running on php 5.3+ and that’s one of the requisites :)
@Carlos @Adrian – did the KM & KM/H > Miles & MPH conversion option ever get added into the plugin? That’s a big request from our users… Thanks!
@James, Yes I did complete the changes and did basic testing, please download the latest version and give it a try.
Has anyone found out how to speed up the load time of the plugin? I’ve noticed that my site, and one other that i know is using it, load *very* slowly.
@Chadd,
There could be several causes of the slow display:
- I need to make several calls to the Strava API (one to get the general information from the rides, and one per ride to get the details) so if you choose to show 5 rides on the widget the plugin makes 6 http calls to the API and that’s how the API is designed.
- The second one is we’re dependant on the speed of the hosting company where the plugin is installed and the speed of the API site.
Can you run a network debug session using firebug or either chrome dev tools to try to see where the problem is?
Carlos
Yes, I can install firebug and run it (and I have), but to be perfectly honest, i don’t know enough to be able to read this and pass on the relevant information.
My unscientific analysis is that it is definitely the plugin that is causing the slow load time. I removed it and my site load time went from 6.37 seconds to 2.2 seconds.
@Chadd,
Sadly the way the Strava API is designed, there’s no other way to pull the data out, one solution will be to add caching to the plugin, and I don’t see that happening soon, as don’t have that much time to spend on it.
Carlos
Hello,
I’m trying to make a homepage using php where I can upload tcx file to Strava and view rides and summary of rides uploaded.
Do you have any tips on how to convert your wp-strava plugin so I can use it on my own homepage(not wordpress) ?
Hi @Richard,
It should be straightforward to use the code. Look for the “strava_request_handle()” function in the wp-strava.php file, it does all the job of querying the Stava API, you’ll also need the two class files (rides.class.php and util.class.php) who encapsulate all the API calls.
Carlos
Hi, This is a cool widget but can I list RUNS or only rides.
We have running members not riders and I want to list them on my site as runners but the widget only lists rides.
is this true?
thanks
@james
I took a quick look at the strava api documentation, and it seems for now that they just support rides for the moment, if you provide me your club name I can search on the rides api and see if it show some data.
Hi Carlos! I’m trying to get WP Strava to work with my WordPress. I’m running the most recent version and PHP 5.0. I keep getting this error when I try to activate it “Parse error: syntax error, unexpected T_STRING in wp-strava.php on line 2″
If its an issue with the version of the PHP that I’m currently running. Is there still a way to get it working with 5.0 ? Because my host only runs 5.0 :(
Hi Carlos! I’m trying to get WP Strava to work with my WordPress. I’m running the most recent version and PHP 5.0. I keep getting this error when I try to activate it “Parse error: syntax error, unexpected T_STRING in wp-strava.php on line 2″
If its an issue with the version of the PHP that I’m currently running. Is there still a way to get it working with 5.0 ? Because my host only runs 5.0 :(
And our club name is Ride Hard To Breathe Easy : http://www.strava.com/challenges/rh2be
We’re trying to get this club stats using the WordPress.
I’m still not able to get it working with PHP 5.0
Hi Shaun,
Will take a look if we can make it work on PHP 5.0, I think the object programming will make it non compatible, but will not be hard to do to convert the classes to functions, anyway will send you a note.
i’ve never heard of something like that before, thank you for sharing this information with us.http://www.whoisdominio.net