Categories

Last.fm 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)

Last.fm for WordPress displays your Last.fm recently listened tracks in your WordPress blog.

Features

  • 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)

Installation

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

Usage

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');

Last.fm for WordPress also has several configurable options. Here’s what you can configure:

lastfm_tracks('username', [tracks], [list], [timestamp], [linked], [encode_utf8]);
  • username: your Last.fm 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);

Customization

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

lastfm_tracks('Ryck');

Download

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

Credits

Contact

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

Code

Maybe you could be interested in my other plugins: Code

134 replies on “Last.fm for WordPress”