[WordPress] 外掛分享: Brickset API

WordPress 外掛 Brickset API 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Brickset API」是 2013-03-22 上架。
  • 目前有 10 個安裝啟用數。
  • 上一次更新是 2014-12-26,距離現在已有 3783 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.5 以上版本才可以安裝。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

natejacobs |

外掛標籤

lego | brick | brickset |

內容簡介

此外掛是 Brickset Web服務的實作。它包含了可用來取得來自 Brickset 的 LEGO® 套裝和主題資料的方法,以及預先格式化的方法來顯示套裝資料。請前往Brickset 了解更多Web 服務的資訊。您可以從Brickset 取得 API 金鑰,以減少 HTTP 請求量和頁面載入時間,所需的套裝資料每日緩存。

主要開發都在 GitHub 上進行中。

此為非官方 Brickset.com 外掛,LEGO® 是丹麥樂高集團的商標,不贊助、授權或支持此外掛。

Oembed

您可以將 Brickset 套裝或主題 url 貼到文章或頁面裡面,發佈後將顯示有關套裝或主題的資訊。以下是兩個範例 URL。

套裝 URL:http://brickset.com/detail/?Set=79003-1
主題 URL:http://brickset.com/browse/themes/?theme=The%20Hobbit

範本標籤

此外掛有許多範本標籤,可在佈景主題中使用,以下是簡短說明。

brickset_themes(); 輸出所有主題的列表。
brickset_subthemes( $theme ); 輸出指定主題的所有子主題、可用年份和套裝數量的表格。
brickset_theme_years( $theme ); 輸出指定主題每年可用的所有年份和套裝數量的表格。
brickset_popular_searches(); 輸出 Brickset.com 上最受歡迎的搜尋詞列表。
brickset_updated_since( $date ); 輸出自指定日期以來更新的套裝的縮略圖、套裝名稱和套裝號碼的表格。
brickset_set_number( $set ); 輸出有關指定套裝的詳細資訊列表,可使用逗號分隔符分隔多個套裝編號,例如 '1380,10240'。

短碼

此外掛有短碼可在您的文章和頁面中使用,以顯示有關套裝或套裝組的資訊。

[bs_set number='XXX'] 輸出有關特定套裝的資訊,包括縮略圖、套裝名稱、套裝號碼、積木數、主題、子主題和年份,您可以使用逗號分隔符分隔多個套裝編號。

小工具

此外掛有四個小工具可在您的佈景主題中啟用,第一個顯示 Brickset 上所有主題的列表和連結以瀏覽Brickset.com,第二個顯示特定套裝的詳細資訊,第三個允許您展示您的總 minifig 數量計數,最後一個小工具顯示每個特定主題的套裝生產數量計數。

進階使用

以下範例展示如何取得有關特定套裝的資料,您可以在這找到開發者文件 此處。

實例化類別。

$brickset = new BricksetAPISearch();

將套裝編號傳遞給 get_by_number 方法。

$set_data = $brickset->get_by_number( '8014' );

檢查是否有錯誤

if( is_wp_error( $set_data ) {
echo $set_data->get_error_message;
}

按您的喜好顯示結果。這會顯示套裝的主題。

else {
echo $set_data->theme;
}

原文外掛簡介

This plugin is an implementation of the Brickset Webservice. It includes methods to get LEGO® set and theme data from Brickset as well as pre-formated methods to display set data. The set data requested is cached daily to reduce HTTP requests and page load time. Please visit Brickset for more information on the webservice. You can obtain an API key from Brickset.
The main development is all happening on GitHub.
This is not an official Brickset.com plugin. LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this plugin.
Oembed
You can paste a Brickset set or theme url into your post or page. Once you publish the post or page information about the set or theme will be displayed. Two example URLs are below.

Set URL: http://brickset.com/detail/?Set=79003-1
Theme URL: http://brickset.com/browse/themes/?theme=The%20Hobbit

Template Tags
The plugin has numerous template tags you are able to use in your theme. They are listed below with a short description.

brickset_themes(); outputs a list of all themes.
brickset_subthemes( $theme ); outputs a table of all subthemes of the theme specified, the number of sets, and years available.
brickset_theme_years( $theme ); outputs a table of all the years the specified theme was available and the number of sets each year.
brickset_popular_searches(); outputs a list of the most popular search terms on Brickset.com.
brickset_updated_since( $date ); outputs a table of the sets updated since the date specified. The table includes thumbnail, set name and set number.
brickset_set_number( $set ); outputs a list of details about the sets specified. More than one set can be requested by separating the set numbers with a comma, e.g. ‘1380,10240’.

Shortcode
The plugin has a shortcode you may use in your posts and pages to display information about a set or sets.

[bs_set number='XXX'] outputs information about a specific set. Thumbnail, set name, set number, pieces, theme, subtheme and year. You can display multiple sets by seperating the set numbers with a comma.

Widgets
The plugin has four widgets you can activate in your theme. The first displays a list of all themes on Brickset with a link to browse each theme on Brickset.com and the second to display the details about a specific set. The third allows you to show off the total count of your minifigs. The last widget displays a count of sets produced in each year for a given theme.
Advanced Use
This example shows how to get the data about a specific set. You can find the developer docs here.

Instantiate the class.
$brickset = new BricksetAPISearch();

Pass a set number to the get_by_number method.
$set_data = $brickset->get_by_number( ‘8014’ );

Test for an error
if( is_wp_error( $set_data ) {
echo $set_data->get_error_message;
}

Display the results how you like. This will display the set’s theme.
else {
echo $set_data->theme;
}

Road Map

Template tags to display sets specific to a user.
Caching of images

You can follow all the open feature requests and enhancements on GitHub.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Brickset API」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0 | 1.1 | 1.2 | 1.3 | 1.4 | 1.4.1 | trunk |

延伸相關外掛(你可能也想知道)

  • Paymentwall for Jigoshop 》Paymentwall 是一個領先的全球數字商品和服務的一站式支付平台,支援超過100種流行的本地支付選項和75多種貨幣,透過單一簡單的融合就能輕鬆地在200多個國家...。

文章
Filter
Apply Filters
Mastodon