[WordPress] 外掛分享: DeadTrees

首頁外掛目錄 › DeadTrees
WordPress 外掛 DeadTrees 的封面圖片
10+
安裝啟用
★★★★
4/5 分(1 則評價)
2248 天前
最後更新
問題解決
WordPress 3.0+ PHP 5.4+ v1.1 上架:2012-07-08

內容簡介

DeadTrees 是一個 WordPress 外掛,可讓您與您的讀者分享正在閱讀的書籍。

它受到其他「我的圖書館」類型的外掛的輕微影響,例如 Now Reading/Reloaded/Redux 等系列的外掛,但這是一個完全使用 WordPress 的自訂文章類型功能重新編寫的外掛。

我寫了 Dead Trees 是因為我想在我的部落格上發布我讀書的狀況,但有時只想寫一些輕鬆的筆記,Dead Trees 讓我(和您!)可以這麼做。

版本 1.1 新增功能:多本書籍封面來源

在 1.1 版本中,書籍封面會從 OpenLibrary.org、LibraryThing 或亞馬遜取得,取決於設置以及所能取得的內容。

如果您已設置好亞馬遜的 API 憑證,您可以選擇首先或最後從亞馬遜查找封面:首先是給那些希望從亞馬遜建立聯盟收入並且擁有豐富的 API 永久配額的人,最後是給那些希望推廣獨立書籍來源或無法或不想使用亞馬遜服務的人。

對於非亞馬遜的書籍封面,首先檢查 OpenLibrary.org,因為它提供較大的圖像。如果 OpenLibrary.org 沒有某本書的封面,並且您已經設置了 LibraryThing API 金鑰,我們會嘗試在 LibraryThing 上找到該書的封面。

OpenLibrary.org 不需要任何 API 憑證或特殊配置。

如何運作

要發佈您閱讀的書籍,您需要在管理員介面中選擇「Books」並輸入書名、作者名稱、ISBN、亞馬遜的 ASIN(可能是 ISBN),如果您希望可以寫一些關於書的內容,但如果您不想寫,可以不寫。

點擊「Publish」後,DeadTrees 將會從 Open Library 或亞馬遜獲取封面並發布書籍。

您也可以像發佈文章一樣標記書籍。標記池在文章和書籍之間共用。

開發在 GitHub 上進行:https://github.com/jbeales/DeadTrees

報告問題:https://github.com/jbeales/DeadTrees/issues

查看公開面的功能,使用自定義範本:https://johnbeales.com/books/

感謝

感謝 OpenLibrary.org 和 LibraryThing 提供的開放書籍封面數據。這些分享信息的 API 讓獨立網頁成為可能並令人愉快。

疑難排解

如果您在查看第一篇書籍文章時出現 404 錯誤,請到管理員介面上的永久連結頁面(設定 > 永久連結)並在 https://github.com/jbeales/DeadTrees/issues/13 上留言或在 wordpress.org 的支援論壇發布問題。

範本
範本標籤

Dead Trees 為您創建了一些範本標籤。以下是一些重要的標籤。如果您想查看不那麼重要的標籤,請查看 template_tags.php,在那裡可以找到所有標籤:

dt_bookbox()

顯示一個包含書籍封面和連結到 Amazon.com、Amazon.ca 和 Amazon.co.uk 購買的方塊。

在 loop 中調用 dt_bookbox() 或傳遞書籍文章的 post ID 給它。

您可以通過在主題中創建名為 deadtree-bookbox.php 的文件來完全自定義 dt_bookbox() 的輸出。您可能需要從 deadtrees/template/deadtree-bookbox.php 開始。

dt_get_amazon_url($domain='amazon.com', $post_id=0)

外掛標籤

開發者團隊

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

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

原文外掛簡介

DeadTrees is a WordPress plugin that allows you to share the books you’ve been reading with your readers.
It’s slightly influenced by other “My Library” type of plugins, such as the whole Now Reading/Reloaded/Redux group of plugins, but is a complete re-write using WordPress’s Custom Post Type features.
I wrote Dead Trees because I want to post on my blog when I read a book, but only sometimes want to write about the book. Dead Trees lets me, (and you!), do that.
New in Version 1.1: Multiple Book Cover Sources
In version 1.1 book covers will be fetched from OpenLibrary.org, LibraryThing, or Amazon, depending on the settings, and what’s available where.
If you have set your Amazon API credentials, you can choose to look for a cover at Amazon either first or last: first for people who are working on building affiliate income from Amazon, and have plenty of API quota, or last for people who prefer to promote independent book sources or can’t or don’t want to use Amazon’s services.
For non-Amazon book covers, OpenLibrary.org is checked first as it provides larger images than other options. If OpenLibrary.org doesn’t have a cover for a book and you have set a LibraryThing API key we will fall back to looking for a cover at LibraryThing.
OpenLibrary.org does not require any API credentials or any special configuration.
How it works
To post a book that you read, you’ll go to the admin of your site and choose “Books” from the main menu. You can then enter the title of the book, the author’s name(s), ISBN, Amazon’s ASIN, (likely the ISBN), and, if you wish, you may write about the book, but you don’t have to if you don’t want to.
Hit publish and the DeadTrees will grab the cover art from Open Library or Amazon and publish your book.
You can also tag the book, just like a post. The pool of tags is shared between posts & books.
Development is on GitHub at https://github.com/jbeales/DeadTrees
Report issues at https://github.com/jbeales/DeadTrees/issues
See the public side in action, with some custom templating: https://johnbeales.com/books/
Thanks
Thanks to OpenLibrary.org and LibraryThing for providing open book cover data. APIs like these that share information make the independent web possible and fun.
Troubleshooting
If you get a 404 error when trying to view your first book post, visit the Permalinks page in the admin, (Settings > Permalinks), and please leave a comment on Github issue #13 or post in the support forums on wordpress.org to let me know that the problem isn’t fixed yet.
Templating
Template Tags
Dead Trees creates some template tags for you. Here are the important ones. If you want to see the not-so-important ones look in template_tags.php, they’re all there:
dt_bookbox()
Displays a box with the book’s cover art and links to buy it from Amazon.com, Amazon.ca, and Amazon.co.uk.
Call dt_bookbox() inside the loop or pass it the post ID of a book.
You can completely customize the output of dt_bookbox() by creating a file called deadtree-bookbox.php in your theme. You might want to copy deadtrees/template/deadtree-bookbox.php as a starting point.
dt_get_amazon_url($domain=’amazon.com’, $post_id=0)
Gets the Amazon affiliate URL for a book.
Choose which site to link to with the first argument, (can be ‘amazon.com’ ‘amazon.ca’ or ‘amazon.co.uk’, defaults to ‘amazon.com’). If called in the loop the second argument is not required, but if you want to call this outside of the loop provide the post ID of a book as the second argument.
dt_get_bookbox_image($post_id=0)
Gets the cover art for a book. If called in the loop this function can, (and should), be called with no arguments. Uses wp_get_attachment_image() to get the image.
dt_get_bookbox_comment($post_id=0)
Gets an extra comment to display in the bookbox. You enter this in the admin in the box that you put the ASIN into. This should be called with no arguments in the loop, or passed the post ID of a book outside of the loop.
Template Files
Dead Trees introduces a new post type: dt_book, and a new taxonomy: dt_writer. This means that you can put a file into your theme called type-dt_book.php and it’ll be used in place of single.php, and you can add taxonomy-dt_writer.php and it’ll be used in place of tag.php. This way you can make your reading list look like a real library!
On Caching Plugins
If you use WP Super Cache, you’ll need to clear your cache, or turn off caching, when updating the design of the bookbox, (updating deadtree-bookbox.php), and when updating your Amazon Affiliate IDs. Once your changes are made just make sure the cache is clear and turn caching back on.
I’m not sure about other caching plugins, but I suspect they’ll behave in a similar manner.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon