因为wordpress更新的原因,flickrRSS也相应做了更新,改变了函数参数的编写方式,并加入了更易于配置的html参数。总之,更强大了,使用也更复制了。
我在flickrRSS高阶使用三部曲之二:在WordPress博客中显示与文章内容相关的Flickr图片中提到的在文章后面显示与文章内容相关的flickr图片的功能如果不加以修改是不能使用的。拖了好几个星期,今天因为改了域名(www.shidelai.cn),所以想有个好的开始,把新的代码搞出来了,和原来的效果一样,接近完美。你可以根据我的代码加以修改成自己的代码,比如如果你的页面比较窄,那么可以把’num_items’ => 8修改为’num_items’ => 5等等。
具体方法如下:
将flickrRSS高阶使用三部曲之二:在WordPress博客中显示与文章内容相关的Flickr图片
<?php get_flickrRSS(8, “community”, “$first_tag”, “square”, “ ”, “ ”); ?>
修改为:
<?php get_flickrRSS(array(‘num_items’ => 8, ‘type’ => ‘public’, ‘tags’ => “$first_tag”, ‘html’ => ‘ <a href=”%flickr_page%” title=”%title%”><img src=”%image_square%” alt=”%title%”/></a> ’)); ?>
就OK了。
参数解释:
The Parameters
‘type’ => ‘user’ – The type of Flickr images that you want to show. Possible values: ‘user’, ‘favorite’, ‘set’, ‘group’, ‘public’
‘tags’ => ” – Optional: Can be used with type = ‘user’ or ‘public’, comma separated
‘set’ => ” – Optional: To be used with type = ‘set’
‘id’ => ” – Optional: Your Group or User ID. To be used with type = ‘user’ or ‘group’
‘do_cache’ => false – Enable the image cache
‘cache_sizes’ => array(‘square’) – What are the image sizes we want to cache locally? Possible values: ‘square’, ‘thumbnail’, ‘small’, ‘medium’ or ‘large’
‘cache_path’ => ” – Where the images are saved (server path)
‘cache_uri’ => ” – The URI associated to the cache path (web address)
Presentational params
‘num_items’ => 4 – The number of images that you want to display
‘before_list’ => ‘‘ – The HTML to print before the list of images
‘html’ => ‘<a href=”%flickr_page%” title=”%title%”><img src=”%image_square%” alt=”%title%”/></a>’ – the code to print out for each image.
Meta tags available: %flickr_page%, %title%, %image_small%, %image_square%, %image_thumbnail%, %image_medium%, %image_large%
‘default_title’ => “Untitled Flickr photo” – the default title
‘after_list’ => ‘‘ – the HTML to print after the list of images
Examples
<?php get_flickrRSS(array(‘num_items’ => 4, ’type’ => ‘public’, ’tags’ => ‘sunflowers’)); ?> – This will display four photos from the public stream that are tagged with sunflowers
<?php get_flickrRSS(array(‘set’ => ’1234567890′, ’num_items’ => 6, ’type’ => ‘set’)); ?> – This will display six photos from a specified set
另外可以参考下本站的源码
[相关文章]- 本文为原创,转载文章请注明: 阿德日志(http://blog.shidelai.cn/2009/03/flickrrss-50.html)















2009-04-2 at 10:47
先留言 再接着看
回复
2009-04-9 at 22:17
先支持下,慢慢学习~!~
回复
2009-04-17 at 18:29
可不可以给个5.0的源文件?弄了半天都没效果 =(
回复
阿德 reply on April 17th, 2009 19:11:
放到文章后面了,右键另存为就可以了
回复
pc412 reply on April 18th, 2009 20:14:
谢谢。。不过你有MSN吗?有些问题想问你 =)
回复
pc412 reply on April 18th, 2009 20:14:
pc412_7@hotmail.com
这是我的~
回复
阿德 reply on May 2nd, 2009 11:35:
俺比较低端,都没用MSN。。。 我去下一个再加你。。, 不好意思回得有点晚
回复
2010-03-22 at 20:16
你好 我用了flickrRSS后一行只能显示一张图片 怎么才能想你的边栏一样一行显示3张?谢谢!
回复
阿德 reply on March 23rd, 2010 9:47:
是不是本来就只有4张照片呀?
回复
Eureka reply on March 23rd, 2010 19:46:
请看一下www.eureka321.com 我设置显示六张照片 但只能单列显示 我希望一行能显示三张
回复
阿德 reply on March 25th, 2010 19:22:
我右边栏上面8张照片也是单列显示的,是不是用widget显示这些照片的啊?
下面6张照片分两行,每行3张是将flickrRSS的代码放到siderbar.php里才达到的效果。
回复
Eureka reply on March 25th, 2010 19:25:
哦 原来如此 谢谢谢谢
回复