Wordpress 20.09.2009

WPLastfm

Displays recent tracks from your last.fm account.

Features

  • Easy to set up via widgets (requires Wordpress > 2.8)
  • Displays your current tracks (Listening now)
  • Customizable by template and css (you decide, what is displayed)
  • Data is kept locally (default: 45 seconds)
  • English and German localization

Requirements

Important: Requires PHP 5! Tested with Wordpress version 2.5.*, 2.6.*, 2.7.* and 2.8.*

Download

Installation

  1. Upload folder wplastfm to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Done

Integration

If you are using widgets

  • Design → Widgets
  • Drag the widget into your sidebar
  • Configure your username, the number of shown tracks and the template
  • Done

If you are not using widgets

Copy the following PHP code in your template:

<?php wplastfm('username' [, number of tracks [, $options]]); ?>

You can configure the plugin via “wplastfm-settings.php” or via array. E.g.

<?php $options = array("template" => '%track%', "cache" => 45, "trunctrack" => 40, "truncalbum" => 25); ?>

For example

<?php
  $options = array("cache" => 120, "trunctrack" => 0, "truncalbum" => 0);
  wplastfm('loeffler', 5, $options);
?>

Customization

The plugin provides the following CSS classes:

  • ul.lastfm
  • ul.lastfm li
  • ul.lastfm li a — last.fm links
  • ul.lastfm li img — image formatting
  • ul.lastfm li cite — time formatting
  • ul.lastfm li span.lastfm-album — album formatting

If you don’t need the wplastfm.css, you can delete it!

Settings

You can change the following settings in the “wplastfm-settings.php” or via array.

  • $wplastfm_options['cache']

    Specifies how long the data is kept locally
    0 = disabled (not recommended)

  • $wplastfm_options['trunctrack'] / $wplastfm_options['truncalbum']

    Maximum length of the text
    0 = no separation

  • $wplastfm_options['timeformat']

    Time format for songs played more than 24 hours ago. For more informations visit http://php.net/date

Changelog

  • Version 1.0.5 (25.11.2009)

    • Fixed error message due PHP 5.3.0 curl bug
  • Version 1.0.4 (28.10.2009)

    • Added a fixed height for the album cover
    • Added the option to configure the maximum length of the title/album
  • Version 1.0.3 (21.09.2009)

    • Fixed a problem with the right version number
  • Version 1.0.2 (20.09.2009)

    • First stable release

Ein Trackback

  1. 24.09.2009 · WPLastfm | Platz der KOSMONAUTEN

Kommentieren