Categories for WordPress

I know the plugin show a nasty error with WordPress 2.8, I am on it, but seems a internal bug (with the HTTP REQUEST API). I have open a bug in the trac system, and I hope to solve this issue soon. Thanks for your patience…
The bug has been solved! You can wait to the next WordPress upgrade or download the modded http.php file into your wp-includes directory) for WordPress displays your recently listened tracks in your WordPress blog.


  • Simply
  • Customizable
  • Widget ready
  • No options page (yes, it’s a feature)
  • Uses WordPress resources (no extra files needed)
  • Multiple widgets (Thanks to Michael Feichtinger)


Drop the lastfm-for-wordpress folder into /wp-content/plugins/ and activate the plug in.


If you use WordPress widgets, just drag the widget into your sidebar and configure.
If widgets aren’t your thing, use the following code to display your recently listened tracks:

lastfm_tracks('username'); for WordPress also has several configurable options. Here’s what you can configure:

lastfm_tracks('username', [tracks], [list], [timestamp], [linked], [encode_utf8]);
  • username: your username
  • tracks: number of recently listened tracks to show
  • list: show tracks in a unordered list
  • timestamp: show a relative timestamp
  • linked: create a link to each track
  • encode_utf8:turn it on if you have encoding problems

Only username is required. The other parameters will take this default values:

lastfm_tracks('username', 5, true, true, true, false);

This is: 5 tracks, in a list, with timestamps and with links.

So, if I wanted to show my last 5 recently listened tracks, not in a list, with timestamps and with links I would use the following:

lastfm_tracks('username', 5, false, true, true);


The plug in provides the following CSS classes:

  • ul.lastfm: the main ul (if list is activated)
  • li.lastfm-item: the ul items (if list is activated)
  • p.lastfm-track: each one of the paragraphs (if tracks > 1)
  • .lastfm-timestamp: the timestamp span class
  • a.lastfm-link: the track link class (if linked is activated)

Live Demo



Version History

1.3.1 – 2008/04/17

  • Fixed: Invalid HTML with titles with special characters. Thanks aljuk

1.3 – 2008/04/08

  • Now using human_time_diff() instead own function: better performance, less code and automagically i18n!

1.2.1 – 2008/04/1

  • I messed it up with the encoding. Now works.

1.2 – 2008/03/31

  • Added encode_utf8 option in order to (hopefully) fix the encoding issues.

1.1.1 – 2008/02/26

  • Small bug fixed. Thanks to Mateus Moraes

1.1 – 2008/01/03

1.0.1 – 2007/09/08

  • Fixed some HTML encoding issues. Props to Dave.

1.0 – 2007/08/22

  • Initial Release



Suggestion, fixes, rants, congratulations, gifts et al to rick[at] or by my contact page.


Maybe you could be interested in my other plugins: Code

134 replies on “ for WordPress”