开发者

organizing a list of pages in the wordpress sidebar using last.fm api

so 开发者_开发问答i have my website, which i did in wordpress - http://chrisgruggen.com/class/mpm35/interactive-self-portrait/

my goal is to make the left sidebar have a list of my top bands (19 or 20 will do). i want them to be organized in order of how many play counts they have (using last.fm api) with the highest being at the top. i also want each band to link to a page within the wordpress site. right now, i have just made each band its own page, and ordered them manually. i'm assuming that id have to write a little bit of php too, however i really dont know any, other than just editing wordpress themes etc.

hopefully this is clear enough. thanks!

  • chris


I'm the developer of PHP Lastfm API so I'll point you in the right direction with that bit.

Take a look at this page in the documentation for a quick walkthrough with how to get going using the API. You only need to use unauthenticated methods you you dont need to read all of step 4, just the first section.

http://sourceforge.net/apps/mediawiki/phplastfmapi/index.php?title=Usage

You now need to call the getTopArtists method in the user package to get back an array with a list of your top artists. Take a look at the example included in the PHP Lastfm API download to see what I mean by this.

http://www.matto1990.com/lastfm_protocol/phpdoc/0.5/apicalls/lastfmApiUser.html#methodgetTopArtists

When you've got the array you can just loop through it and output the HTML you need.

I cant help too much with the Wordpress stuff but I think you could do some magic with a single page and short codes:

http://codex.wordpress.org/Shortcode_API

Hope this helps you out a bit, and dont forget to post in the PHP Lastfm API group with a link to your project so I can add it to the list on the project website:

http://www.last.fm/group/PHP+Last.fm+API/forum/105368/_/545041

Matt Oakes

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜