內容簡介
啟用外掛後,您將擁有兩個新的範本標籤:
<?php previous_archive_link( 'format', 'link' ); ?>
<?php next_archive_link( 'format', 'link' ); ?>
它們會根據日期存檔是否是一天、一個月或一年來調整輸出,
並且它們將僅針對您已發佈文章的相鄰時間段輸出連結。這兩個標籤都需要兩個字符串參數:format和link。
format參數定義了連結前後的內容,其中%link
將被下面的link參數替換。 previous_archive_link
預設為 "“« %link”",而next_archive_link預設為 "“%link »“。
link參數定義了連結文本,這兩個標籤都默認為 "“%date“,
相鄰存檔頁面的本地化日期。
如果您有興趣貢獻此外掛程式的程式碼,該項目也可以在GitHub上找到:
https://github.com/justincwatt/wp-adjacent-archive-links
外掛標籤
開發者團隊
原文外掛簡介
After activating the plugin, you will have two new template tags at your disposal:
They adapt their output depending on whether the date archive is a day, a month,
or a year, and they will only output a link for an adjacent time period in which you
have published posts. Both tags take two string parameters, format and link.
The format parameter defines what comes before and after the link. In it, %link
will be replaced with whatever is declared in the link parameter below. previous_archive_link
defaults to “« %link” and next_archive_link defaults to “%link »“.
The link parameter defines the link text. Both tags default to “%date“, the
adjacent archive page’s localized date.
If you’re interested in contributing to the code behind this plugin, it’s also hosted on GitHub:
https://github.com/justincwatt/wp-adjacent-archive-links
