简体   繁体   English

使用last.fm api在wordpress侧栏中组织页面列表

[英]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/ 所以我有我在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). 我的目标是使左侧边栏有我的顶级乐队列表(19或20个可以)。 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. 我希望按他们具有多少个游戏计数(使用last.fm api)进行组织,最高计数在顶部。 i also want each band to link to a page within the wordpress site. 我还希望每个乐队都链接到wordpress网站内的页面。 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. 我假设id也必须写一点点php,但是我真的不知道,除了编辑wordpress主题等。

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. 我是PHP Lastfm API的开发人员,因此,我将向您指出正确的方向。

Take a look at this page in the documentation for a quick walkthrough with how to get going using the API. 请查看文档中的此页面,以快速了解如何使用API​​。 You only need to use unauthenticated methods you you dont need to read all of step 4, just the first section. 您只需要使用未经身份验证的方法,就不需要阅读第4步的所有内容,只需阅读第一部分。

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

You now need to call the getTopArtists method in the user package to get back an array with a list of your top artists. 现在,您需要在用户包中调用getTopArtists方法,以获取包含您的主要艺术家列表的数组。 Take a look at the example included in the PHP Lastfm API download to see what I mean by this. 看一下PHP Lastfm API下载中包含的示例,以了解我的意思。

http://www.matto1990.com/lastfm_protocol/phpdoc/0.5/apicalls/lastfmApiUser.html#methodgetTopArtists 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. 当你得到了数组,你可以通过它输出你需要的只是HTML循环。

I cant help too much with the Wordpress stuff but I think you could do some magic with a single page and short codes: 我无法在Wordpress方面提供太多帮助,但我认为您可以用一页和短代码做一些魔术:

http://codex.wordpress.org/Shortcode_API 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: 希望这有助于你出去了一下,不要忘了PHP LastFM等API组发布一个链接到你的项目,所以我可以将它添加到项目网站上的名单:

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

Matt Oakes 马特·奥克斯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM