cyclopress pages

Download CycloPress Now →

Table of Contents

  1. What It Is
  2. Screenshots
  3. Requirements
  4. Installation
  5. CycloPress API
  6. Notes and To Do List
  7. Changelog

What It Is

CycloPress is a WordPress Plugin for cyclists designed by Andrew M. Whalen. It allows you to track your statistics from each ride you take. After each ride you can copy down the data from your cyclocomputer and enter it into CycloPress. Graphs and a summary of your statistics will be generated. See my cycling page for an example of what this plugin can do.



  • PHP version 4.3.1 or higher.
  • GD library version 1 or 2.
  • WordPress version 2.5 or higher. Older versions may work, but don’t count on it.


  1. Unzip and upload the cyclopress folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the Plugins menu in WordPress.
  3. Make the /wp-content/plugins/cyclopress/graphs/ directory writable by your web server by setting the correct permissions, e.g. chmod 775 graphs. Some server setups may not require this step. Check the CycloPress options page first to see if the graphs directory is writable.
  4. Add your cycling stats through the Write -> Ride interface.
  5. Add the CycloPress widget to your sidebar, and create a cycling stats page through the CycloPress admin.
  6. Manage/edit your cycling stats through the Manage -> Rides interface.

CycloPress API

If you know what you’re doing, these are the function calls that you can insert into your WordPress templates. If you also use a plugin for WordPress that allows PHP in posts and pages, you can paste these there as well.

cy_get_brief_stats($before='<p>', $separator=', ', $after='</p>')
Returns your total miles traveled and average speed wrapped in a paragraph tag. Returns `false` if no data is available. This is how the widget data is generated. This works best in a sidebar, since it’s just a teaser of all the information available.
cy_get_summary( [ bool $compare=false, string $year=false ] )
Returns a summary of your lifetime stats as an XHTML definition list (<dl>). Returns false if no data is available. The parameter $compare takes a boolean (true or false) and will add text that compares your lifetime statistics to how you’ve done so far this year. The parameter $year takes a 4-digit year and will give you statistics on that year instead of your lifetime statistics.
cy_get_first_ride_date($format='F jS, Y')
Returns the date of the least recent ride (e.g. the first ride) in the database. If the earliest date you entered stats for was June 16, 1999, then this would return June 16, 1999. You can use this to do something like ‘These stats have been tracked since June 16, 1999.’ To change the format, see PHP’s date format codes.
cy_get_last_ride_date($format='F jS, Y')
Returns the date of the most recent ride in the database. If the most recent date you entered stats for was August 12, 2008, then this would return August 12, 2008. You can use this to do something like ‘The last ride was on August 12, 1999.’ To change the format, see PHP’s date format codes.
cy_get_graph_img_tag( $type='distance' )
The parameter $type can be distance or average_speed. This returns a complete XHTML image tag for either a distance graph or an average speed graph. Set the width, height, and other parameters for these graphs in the CycloPress Options page found under the Plugins tab.

Notes and To Do List

  • As of version 1.3.9 CycloPress is getting very bulky (around 3000 lines). It’s in desperate need of a good rewrite before I add some features (like i18n).
  • Although CycloPress tracks many stats, most of them can’t yet be graphed.
  • A ‘type’ of ride would be nice. Personally, I only track rides for ‘training’, but I don’t track ‘fun’ rides at all. I’ll add a way (maybe just tags?) to differentiate between these types so they can be graphed separately.
  • User-controllable graphs. The graphs that are produced now are simple and only track distance and average speed over time. I want to add an interface to produce graphs ‘on the fly’ with parameters the user chooses.
  • I may add a Flash or JavaScript graphing library in the future for more dynamic graphs, but I’ll keep the static images as a fallback. The Google API looks promising for this use.
  • Translations into other languages will probably not happen for quite some time. I’ll need to rewrite a lot of the code for internationalization (i18n).
  • The WordPress upgrade.php file throws a few errors now when CycloPress is installed or upgraded. It looks like the WP SQL dbDelta function may be to blame again.Fixed in version 1.4.3
  • More statistics data. I only have a simple cyclocomputer, so I need to find out first what kinds of data the more complex computers actually track.Added in version 1.3.9
  • Ride more than one bike? I’ll find a nice way to track what bike(s) you ride.Added in version 1.3.9
  • If you want a Cycling page, there is no way to do this without modifying your templates and/or adding a plugin to parse PHP in your pages. I want to find a nice way of making this automatic.Added in version 1.3.6
  • Currently there is no way to edit previously entered statistics. This will be in a future version.Added in version 1.2.8
  • An option to enter statistics in other units (such as kilometers) will be added in a future version.Added in version 1.2.8


1.5.1 – January 4, 2010

  • Fixed some display errors resulting from having no data in the new year.

1.5.0 – December 2, 2009

  • Updated the highest compatible version to WordPress 2.9.

1.4.9 – August 18, 2009

  • Updated the readme file.

1.4.8 – August 18, 2009

  • Updated to use get_option(‘siteurl’) instead of get_bloginfo(‘url’). This should make it so that graphs show up even if WP’s home page is outside of the wordpress code directory.

1.4.7 – August 18, 2009

  • A couple places were missing the code to convert miles to kilometers if the user had that option set.

1.4.6 – July 23, 2009

  • Fixes a few places where times were showing incorrectly.

1.4.5 – July 20, 2009

  • Updates the compatible version to 2.8.2.

1.4.4 – July 20, 2009

  • Fixes the error “Only variables can be passed by reference” on like 1948.

1.4.3 – June 7, 2009

  • Fixes a problem with calling the WordPress upgrade.php file, specifically the dbDelta() function. This was giving warnings to users when they upgraded or installed CycloPress.
  • This update also makes CycloPress ready for WP 2.8 which will be released June 10th.

1.4.2 – May 17, 2009

  • There was something going wrong with the cy_bikes SQL so the table wasn’t being created when CycloPress was installed/upgraded. I removed the ‘default’ field as I wasn’t using it, and it all works now.

1.4.1 – May 16, 2009

  • Added additional stats to the calendar view
  • Added title tags to the calendar view links so you can hover and get a quick glimpse of a ride (I may add more robust hover information in the future)
  • Made the time formats more consistent (i.e. “1 hour, 36 minutes” instead of “1.6 hours”)

1.4.0 – May 8, 2009

  • Nothing new. I just messed up the wordpress svn stuff again.

1.3.9 – May 7, 2009

  • Added a way to track which bike you used on a given ride.
  • Added a calendar view so you can see your stats by month.
  • Added a bunch of new fields to the database like heart rate, elevation, calories, and weight.
  • Organized the admin navigation.

1.3.8 – January 31, 2009

  • Fixed a problem with the WordPress function dbDelta that resulted from the way I wrote SQL. Specifically I had back-ticks around the table names, and dbDelta wouldn’t recognize those table names so it could apply any schema changes I made.

1.3.7 – January 31, 2009

  • Fixed a bug that wouldn’t allow rides to be saved.

1.3.6 – January 26, 2009

  • You can now create a cycling stats page without a third-party PHP plugin.
  • Export your stats in XML and CSV format.

1.3.5 – December 12, 2008

  • WordPress 2.7 changed the admin navigation up a little, so the Add a Ride and Manage Rides pages were showing up at the same time. They were separated once again.
  • The table column header links in Manage Rides were showing up too light in the 2.7 admin theme. They were made darker.

1.3.4 – December 8, 2008

  • Graphs were being created any time a CycloPress function was called. That’s a bad thing. It’s been fixed. Thanks, Dave.

1.3.3 – September 14, 2008

  • Changed the way the stats display in the admin stats page.

1.3.2 – September 12, 2008

  • Added a stats page to the admin interface.

1.3.1 – September 10, 2008

  • Added an admin nav bar to easily switch between CycloPress pages.
  • Made the debug page nicer.
  • ‘Editors’ were given permissions to add and edit rides.
  • Sort-by-column for the management page.
  • Various bugs were fixed.

1.3.0 – September 8, 2008

  • Fixed a bug with the new CYRide PHP object where it wasn’t being instantiated before use in certain cases.

1.2.9 – September 3, 2008

  • No changes. The 1.2.9 tag was added to make the WordPress Plugin repository host the most current version.

1.2.8 – August 26, 2008

  • Added ability to manage/edit previous rides.
  • Added option to change units between miles/kilometers.

1.2.7 – August 14, 2008

  • Now checks the PHP version (4 or 5) to see what version of JPGraph to use.
  • A simple sidebar widget is now also included.

1.2.6 – August 13, 2008

  • Added code for a sidebar widget, but didn’t make it functional.

1.2.5 – August 10, 2008

  • Fixed tiny bug in displaying CycloPress version.

1.2.4 – August 10, 2008

  • Fix the problem where ‘upgrade automatically’ doesn’t call cy_install, so the graphs get deleted but never rewritten.

1.2.3 – August 8, 2008

  • Removed the final remnants of php short tags (<?= ?>).
  • Added conversion functions for miles to kilometers and back and an option to set what distance unit to use, although these new functions and option are not in use yet.

1.2.2 – August 6, 2008

  • Readme cleanup.

1.2.1 – July 9, 2008

  • Added a file to the graphs directory so that directory is present in the CycloPress ZIP download.
  • The readme file was cleaned a little as well.

1.2 – July 1, 2008

  • Readme cleanup.

1.1 – July 1, 2008

  • Readme cleanup.

1.0.1 – July 1, 2008

  • Readme cleanup.

1.0 – July 1, 2008

  • First version of CycloPress.


93 Responses to “CycloPress”

  1. @Richard, try out version 1.4.5 and your problem should be fixed.

  2. Wow, speedy response!!! Found that the PHP exec plugin made the page functional, so not able to replicate the issue, just updated, and I’ll test it out and let you know. Thanks for the update!

  3. Hi! After the installation, I got the following error:

    WordPress database error: [Multiple primary key defined]
    ALTER TABLE wp_cy_rides ADD PRIMARY KEY (id)

    WordPress database error: [Multiple primary key defined]
    ALTER TABLE wp_cy_bikes ADD PRIMARY KEY (id)

    WordPress database error: [Multiple primary key defined]
    ALTER TABLE wp_cy_types ADD PRIMARY KEY (id)

  4. Nevermind. It was solved.

  5. Andrew, Thanks for the recent updates.

    you might like to add the use of your provided functions
    into the ‘cy_get_summary’ and ‘cy_get_summary_compare’ functions so they get used when displaying stats rather than the currently hard-coded miles and mph version

  6. Andrew, thanks for updates, again.

    Have you had a look at the “Open Flash Chart Core WordPress Plugin” as a means to creating dynamic graphs rather than using jpgraph.

    The only trouble I see is it produces SVG images. Which are cool for FF, Chrome, Opera but are not displayed without plugins in IE6,7,8,n.

    Just a thought.
    Also if you like I have hacked some code for displaying Graphs per bike (jpgraph) in Cyclopress but am pretty sure I cant post it here…
    I’ll post an archive at my website link for a few days if you are interested

    cheers dave

  7. Andrew, Don’t mind me I just spent 2 days looking at SVG image creation with php and JSON and stumbled upon the “Open Flash Chart Core WordPress Plugin” and kept thinking output=svg when der! its a flash/swf display with data input!
    sorry for my stupidity

  8. Andrew, great plugin. I too needed to install Exec-php to get the stats page to work.

    If I could ask for a feature, it would be to be able to add in other sports like running & swimming as this certainly beats my crappy spreadsheet…


  9. Great work, Andrew. I had the same problem as the others without Exec-php. Works great now, though.

    If I had one wish, it would be a way to Delete a ride.

  10. Hello — After I setup and go to the “Cycle Page” in options.. it gives me this.

    Fatal error: Only variables can be passed by reference in /home/content/a/r/l/arleighjenkins/html/wp-content/plugins/cyclopress/cyclopress.php on line 1963

  11. I’m using WordPress 2.8.6 and CycloPress 1.5.0.

    Inputting rides work, widget work, graphs on cycling page (admin) work. Page on website stays in default state ( Any ideas what could cause this?

  12. Rudy, you’ll need to install another WordPress plugin called Exec-PHP which allows PHP code in your posts to be executed. It’s not stated in the requirements any more, but it’s still required. Sorry about that.

    For anyone else reading this, I’m actively working on version 2, which I hope to have out before the end of the year. It will eliminate the requirement of having the additional PHP-exec plugin installed.

  13. Thank you very much, it works! Already a very nice plugin!

  14. Andrew,

    Thanks a lot for your wonderfull plug in.
    It works very well and is a pleasant addition to any cycling wordpress install.


  15. Great plugin – but I get wierd page error —

    No stats! Get out there and ride!

    “; } ?>

    Any Ideas? Debug doesn’t show any issues.


  16. Warning: Division by zero in /home/andy/ on line 268

    Warning: Division by zero in /home/andy/ on line 279

    Thanks a lot for your great plug in, So far there has been no problem , but now is not.
    Would you check this problem … ? i can not so …

  17. Tim, that looks like you need to install an additional plugin which allows you to have PHP in your posts. I suggest Exec-PHP for this purpose.

    Atoran, I’ll get on fixing that soon. I can tell right away what the problem is.

  18. That fixed [sic] it! Thanks!

  19. CycloPress 1.5.1 fixes the division by zero issue.

  20. Andrew,

    Thanks a lot.
    It works very well ^^

  21. Andrew

    Is it possible to have the widget dipsplay the amount of km/miles per year instead of the whole total ?

    I.e :
    Instead of : 1865.35 kilometers, 18.2 km/h average speed
    2009 : 1865.35 kilometers, 18.2 km/h average speed
    2010 : xxxx kms xxx average speed


  22. Hi,
    Thanks for a good script!:)
    You can add different bikes, can I get this information in the graphics?
    Example, perhaps mountain biking one day and the next road.
    Where do I change the background color of the image statistics?


  23. Hi Andrew,

    I’ve been waiting for this plugin for years! I finally found it! Its awesome! But I can’t see my graphs? The control panel seems to work fine. It stores my ride data and I’ve read that Bluehost has the GD Library. I can’t seem to figure out how to make sure the directory is writeable, but you say to look at the Cyclopress Options page. It looks fine, but doesn’t say whether or not its writeable.

    Any suggestions? I love this plugin–not sure why there aren’t tons for wordpress by now!

  24. Luc, I can certainly add that as a feature in the next release.

    Martin, I probably won’t be adding exactly what you’re asking for, since the graphs would get crowded fairly quickly. However, I’m working on a custom graph creator so you can chart stats for separate bikes or stats, instead of using the default graphs.

    Farrin, you might try installing an additional plugin called PHP-Exec. If that doesn’t work let me know and I’ll give more info on what you need.

    I’m a little behind on getting out the next release of CycloPress, but I’m making sure that additional plugins won’t be required, and a lot of the feature requests will be handled.

  25. Hi Andrew,

    Thanks again. I tried installing the PHP-Exec and it didn’t change the cycling stats page. Any other hints or suggestions? Here’s the page:

  26. Andrew,

    Thanks a lot!:)

  27. I am having the same issue as Farrin – I did try installing PHP-exec, but no go. i see his page is working now?
    Any advice? Thanks!

  28. Im gettign the same display as Tim did above. Ive installed PHP-Exec and nothing changed. Im sure its a simple case of something Im not doing.

  29. Try going into the Cycling Page Options under CycloPress Options and change something like the name of the page, then save it. This should trigger an update of the page. If it works you can change the name back to the original.

  30. Will there be an update soon? Things aren’t working for me.

  31. Andrew,

    Wonderful plugin. Thanks so much for sharing it with the world. I’ve rediscovered biking and this plugin is perfect for tracking my workouts. The only improvement I could possibly think of is to be able to setup a default bike rather than re-entering it for each new ride. Thanks again for this first-class plugin. JR.

  32. Did the stats page display problem get fixed ? I just installed this and appear to have the same problem (tried all the above without success) – I note that Farrin’s page now works though

  33. Works like a charm!! Only thing missing is the function to delete a ride!

  34. Hi,

    Are there any updates to CycloPress planned? I really like the plugin, but being able to delete a ride, or reset your statistics would be great. As would Luc’s suggestion from last year (suspect he came here for the same reason I did! I want to seperate this years stats from last years..)


  35. Very nice plugin! Nice to have statistic on your own site.

    Two Questions: How do i display the way it`s shown at your page(2007, 08,09 etc.)?

    And as it is a nice and usefull plugin, how do i make a link.


  36. Hi,

    Nice plugin! Thanks for all the good work!

    If I may suggest:

    I think the Write interface plugin should have a way of importing a ride – from any or all of the following formats:

    .gpx – almost a standard way of mapping gps routes
    .kml – google’s way of gps map routes
    .tcx – garmin seems to export data to these file formats

    This would be wonderful – I come back from a ride, plugin my device, download the file, fire up my website and upload the file, and my ride is recorded!

    Please let me know if I could help in any manner to get this done – least, I could test it out for you!

    Thanks again for all the good work!


  37. Thank you so much for a great plug in. I was having a problem with the rides page but once I read these comments and found out about exec-php it worked just fine. You might want to add that into the install instructions as an aside as it seems to be a problem for many. Otherwise I think its a great plug in and cant want to play around with the widget.

  38. One more small question, is there a way to add or show just the latest rides states? (Distance, time, pace, etc). I would like to be able to add some info to a post either with PHP or some other way. I can execute the stuff from your API list but it only shows the latest ride date, but no other info.


  39. Greate plugin!
    But is it possible to add some “tags” to the exercise, so I can log eg. spinning training, “fun rides”, competitions etc. and not just “a ride”?
    When I exerciese in the winters, I do not ride the bike – i’m on the gym and spinning and then I can’t log any distance… 🙂

  40. We would like to add it to the following site , it is perhaps better to wait for an upgrade of puglin?

  41. Hi

    This plugin really is something I could use, I just need some additional data to put in. I want to combine my cycling log and my diabetes log to keep track of diabetes related issues during my rides. Can/will somebody help??

    Kind regards

  42. Hi. firstly THANK for an excellent plugin! Really love it, and doing 2012 miles in 2012 challenge, it really hits the spot.
    I am however struggling to get the Page functionality to work. In the back end I can see all the graphs and data etc, and the sidebar widget is updating perfectly as well, but if i add the Cycling page I just get the page saying that there is no data and “get out and ride”. So I am not sure why it’s not picking the data up. I haven;t amended the page in any way – simply just published it.
    Do you have any pointers as to what or why this might be happening?
    Thanks again for your excellent work!

  43. I can´t make my stats to display separate years, like you have done in your cycling page. You can teach me how to do?

Leave a Reply