[WordPress] 外掛分享: JSON feed

首頁外掛目錄 › JSON feed
100+
安裝啟用
尚無評分
5963 天前
最後更新
問題解決
WordPress 2.7.1+ v1.3 上架:2009-05-15

內容簡介

非常簡單的外掛。新增了一種可訂閱的新型態 feed。只需在正常 feed 的任何地方添加 ?feed=json,即可獲得 JSON 格式的內容(但只有活動的縮小版本)。

版本 1.1 新增了對 JSONP 的支援。若想要獲得 JSONP 回應而非一般 JSON 結構,只需在查詢中添加 jsonp=callbackName,其中 callbackName 是要包覆的函式名稱。

想要使用 jQuery時,可以使用以下方式:

$.getJSON("http://example.com/feed/?feed=json&jsonp=?",
function(data){
console.debug(data[0].title); // print title of first item to firebug console
});
});

(感謝 Dan “Tack” Trudell)

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.3) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「JSON feed」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Pretty simple, really. Adds a new type of feed you can subscribe to. Simply
add ?feed=json to anywhere you get a normal feed to get it in JSON form
(but with a cutdown version of events).
Version 1.1 added support for JSONP. To get a JSONP response instead of a
normal JSON structure, simply add jsonp=callbackName to your query, where
callbackName is the name of the function to be wrapped with.
To use this with jQuery, you’ll want to do something like:
$.getJSON("http://example.com/feed/?feed=json&jsonp=?",
function(data){
console.debug(data[0].title); // print title of first item to firebug console
});
});

(thanks to Dan “Tack” Trudell)

延伸相關外掛

文章
Filter
Apply Filters
Mastodon