
內容簡介
此外掛可讓您管理文章參考文獻,類似 Drupal CMS 模組功能中的「Node Reference」。
使用「參考文獻設定」頁面設定出版物連線。
設定步驟完成後,您會在文章編輯頁面上看到其他的 metabox(s)。您可以選擇要附加到正在編輯的文章的參考文章類型的文章。
此外掛會將已連線的文章列表儲存為文章元資料。您可以使用例如 get_post_meta($post->ID, 'ref_ID', 真實) 來接收該列表。作為「ref_ID」,您應在之前「參考設定」頁面中配置的元資料鍵使用。
此外掛允許您配置 widget 以查看已附加文章的列表。
此外掛 API
此外掛有自己的 API,可讓您從您的程式碼中建立參考文獻(註冊自己的文章類型後等等)。所有函數都是靜態的,可通過 REFShraAPI 類別使用。
目前已實作 5 個函數。函數列表如下。有關 API 函數、其引數、示例的更多詳細資訊請參閱 reference.php。
REFShraAPI::config_load($postType = NULL, $refKey = NULL);
// 返回當前配置之參考文獻的陣列。
REFShraAPI::config_add($postType, $refKey, $linkedTypes, $title)
// 新增/更新參考文獻配置。
REFShraAPI::config_remove($postType, $refKey);
// 刪除 pair postType / refKey 的參考文獻配置。
REFShraAPI::get($postID = NULL);
// 透過文章 ID 取得參考文獻資料。
REFShraAPI::update($postID = NULL, $refkey, $postIDs);
// 透過文章 ID 更新參考文獻資料。
REFShraAPI::find($postID = NULL, $postTypes = array(), $onlyPublished = false);
// 尋找已附加 post_id 的文章。
縮短碼 REF
此外掛支援縮短碼 REF。它可讓您在文章任何位置顯示參考文章的列表。縮短碼函數實作可讓您自訂列表和輸出。只有兩個屬性可用。
[ref id=”POST_ID” key=”REFERENCE_KEY”]
外掛標籤
開發者團隊
原文外掛簡介
This plugin will let you manage the post references. It is like “node reference” in Drupal CMS module functionality.
Use Reference Settings page to configure publications connections.
After configuring step you will see additional metabox(s) on post editor page. Now you can choose articles of referenced post types to attach it to article you edit.
Plugin stores connected article list to post metas. For template you can use, for example, get_post_meta($post->ID, ‘_ref_ID’, true) to receive that list. As ‘ref_ID’ you should use a meta key configured on Referenced settings page earlier.
Plugin allow you to configure widgets to view the list(s) of attached articles.
Plugin API
Plugin has own API which allows you create references from your code (after registering your own post types, etc). All functions are static and available through class REFShraAPI.
Currently there are implemented 5 functions. List of functions is below. More details about API functions, their arguments, examples look in referenece.php.
REFShraAPI::config_load($postType = NULL, $refKey = NULL);
//returns array currently configured REFERENCES.
REFShraAPI::config_add($postType, $refKey, $linkedTypes, $title)
// ADD/update REFERENCE configs.
REFShraAPI::config_remove($postType, $refKey);
// Delete REFERENCE config by pair postType / refKey.
REFShraAPI::get($postID = NULL);
// Get references data by post ID.
REFShraAPI::update($postID = NULL, $refkey, $postIDs);
// Update references data by post ID.
REFShraAPI::find($postID = NULL, $postTypes = array(), $onlyPublished = false);
// Search for article with attached post_id
Shortcode REF
Plugin supports shortcode REF. It allows to show list of referenced articles in any place of your post. Shortcode function implementation allows you customize list and output. Only two attributes are available.
[ref id=”POST_ID” key=”REFERENCE_KEY”]
