內容簡介
當顯示單一文章時,您可能想在相同分類中顯示鏈結至上一篇和下一篇文章。
那很好;WordPress 讓你透過 previous_post_link() 和 next_post_link() 完成此操作。
但是,如果該文章屬於多個分類呢?
如果使用者來自於標籤或作家頁面,從那個特定的群組顯示上一篇 / 下一篇文章會更有意義,不是嗎?
這個外掛程式提供了一組類似的功能,可以實現這個想法: previous_post_smart() 和 next_post_smart()。
它是這樣運作的:
每當訪客前往存檔頁面(類別、標籤、日期、作家、搜尋等),外掛程式會將此存檔位置紀錄在瀏覽器 cookie 中。
然後,如果訪客從該存檔頁面前往單一文章,外掛程式會基於 cookie 中的信息生成上一篇 / 下一篇鏈接。
鏈接: 外掛程式新聞 | 作者網站
外掛標籤
開發者團隊
原文外掛簡介
When displaying a single post, you might want to show links to the previous and next posts in the same category.
That’s fine; WordPress let’s you do this with previous_post_link() and next_post_link().
But what if that post is in multiple categories?
What if the user came to that post from a tag page or from an author page? Wouldn’t it make more sense to display previous / next posts from that particular set?
Well, you can do this with a similar pair of functions, provided by this plugin: previous_post_smart() and next_post_smart().
Here’s how it works:
Whenever a visitor goes to an archive page (category, tag, date, author, search etc.), the plugin notes which archive it is in a browser cookie.
Then, if the visitor goes to a single post from that archive page, the plugin generates the prev / next links based on the information in the cookie.
Links: Plugin News | Author’s Site
