跳到内容

Flickr API

v0.1.9

Robert O'Rourke · 2011年10月14日 上架

A comprehensive Flickr plugin that makes it easy to show off your images in style.

正在使用
20+
评分
2.5 / 5
累计下载
9,326
最近更新
2014年7月24日
2 条评价需要 WordPress 3.0+已测试到 3.9.40

The Flickr API plugin provides tools for displaying your flickr galleries, sets, photostream or favourites and more using a shortcode in posts and pages or as a widget. You can choose the size of image you want, whether it should be linked to another image size or back to flickr or not linked at all, how many images to show and more…

There are some built in options for displaying your images as a simple slideshow or using the Galleria jquery plugin. Alternatively you can choose to style the output yourself and use your own javascript.

For developers the plugin also gives you an easy method for calling and caching API responses both in PHP and javascript, and lots of useful tools for working with those responses.

Usage

You will need to get an API key from flickr to use this plugin. Under the ‘You’ menu look for ‘Your Apps’. Click to get a key and then go to the media settings screen to add your API key and user name. The plugin will automatically determine your NSID so you never need to look this up.

To use the plugin either generate a shortcode using the media upload/insert button and selecting what you want to get or use the Flickr widget provided.

For developers

The plugin exposes its methods for your use in themes as template tags but the main one you may find useful is flickr_api(). This is a general function for calling any API method with the parameters you specify.

<?php
$response = json_decode( flickr_api( $method, $params, $cache ) );
?>

All responses are in JSON format so you will need to use json_decode() to use the response in PHP.

@param $method: (string)    This is the API method to call
@param $params: (array)     Additional arguments to pass into the call such as user_id, photoset_id, gallery_id, text, tags etc...
@param $cache : (bool)      Whether or not to cache the response based on the arguments passed in

You can use the API via javascript as well:

<script>
var photos = flickr_api( method, params, cache );
</script>

NSID lookup:

<?php
$nsid = flickr_get_user_nsid( $username );
?>

Just pass in the Flickr username of the person to get the NSID for.

Filters/Hooks

flickr_galleria_themes

You can enable the choice of custom or purchased galleria themes by extending the themes array. Useful if you want your theme to have a choice of galleria theme beyond the ‘classic’ style.

<?php
add_filter( 'flickr_galleria_themes', 'my_galleria_themes' );
function my_galleria_themes( $themes ) {
    $themes[ /* full or relative url to theme js file */ ] = __( 'Theme Name' );
    return $themes;
}
?>

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums