因为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
另外可以参考下本站的源码
[相关文章]





