前言介紹
- 這款 WordPress 外掛「WP-PageNavi」是 2006-01-02 上架。
- 目前有 500000 個安裝啟用數。
- 上一次更新是 2024-12-19,距離現在已有 136 天。
- 外掛最低要求 WordPress 4.6 以上版本才可以安裝。
- 有 149 人給過評分。
- 論壇上目前有 2 個提問,問題解答率 0%
外掛協作開發者
外掛標籤
pages | paging | navigation | pagination |
內容簡介
想要取代舊的 ← Older posts | Newer posts → 連結,並改為一些頁面連結嗎?
這個外掛提供了 wp_pagenavi() 的樣板標籤,可以產生豪華的分頁連結。
使用方式
在你的主題中,你需要找到 next_posts_link() 和 previous_posts_link() 的呼叫,然後取代它們。
在 Twentyten 主題中,它看起來像這樣:
你可以用以下兩行取代它們:
對於多部分頁面,你必須搜尋像這樣的代碼:
並且取代它們:
'multipart' ) ); ?>
到 WP-Admin -> 設定 -> PageNavi 做設定。
更改 CSS
如果你需要設置 WP-PageNavi 的 CSS 風格,你可以將外掛目錄中的 pagenavi-css.css 文件複製到你的主題目錄中,並在那裡進行修改。這樣,當你更新外掛時,就不會失去你的更改。
或者,你可以取消設定頁面上的「使用 pagenavi.css?」選項,並將樣式直接添加到你的主題中的 style.css 文件中。
更改類名稱
有一些過濾器可以用來更改分頁導航元素所分配的預設類名稱。
過濾器
wp_pagenavi_class_pages
wp_pagenavi_class_first
wp_pagenavi_class_previouspostslink
wp_pagenavi_class_extend
wp_pagenavi_class_smaller
wp_pagenavi_class_page
wp_pagenavi_class_current
wp_pagenavi_class_larger
wp_pagenavi_class_nextpostslink
wp_pagenavi_class_last
使用過濾器
// 簡單用法 - 一個過濾器的回調
add_filter('wp_pagenavi_class_previouspostslink', 'theme_pagination_previouspostslink_class');
add_filter('wp_pagenavi_class_nextpostslink', 'theme_pagination_nextpostslink_class');
add_filter('wp_pagenavi_class_page', 'theme_pagination_page_class');
function theme_pagination_previouspostslink_class($class_name) {
return 'pagination__control-link pagination__control-link--previous';
}
function theme_pagination_nextpostslink_class($class_name) {
return 'pagination__control-link pagination__control-link--next';
}
function theme_pagination_page_class($class_name) {
return 'pagination__current-page';
}
// 更簡潔的用法 - 一個回調用於所有過濾器
add_filter('wp_pagenavi_class_previouspostslink', 'theme_pagination_class');
add_filter('wp_pagenavi_class_nextpostslink', 'theme_pagination_class');
add_filter('wp_pagenavi_class_page', 'theme_pagination_class');
function theme_pagination_class($class_name) {
switch($class_name) {
case 'previouspostslink':
$class_name = 'pagination__control-link pagination__control-link--previous';
break;
case 'nextpostslink':
$class_name = 'pagination__control-link pagination__control-link--next';
break;
case 'page':
$class_name = 'pagination__current-page';
break;
}
return $class_name;
}
原文外掛簡介
Want to replace the old ← Older posts | Newer posts → links with some page links?
This plugin provides the wp_pagenavi() template tag which generates fancy pagination links.
Usage
In your theme, you need to find calls to next_posts_link() and previous_posts_link() and replace them.
In the Twentyten theme, it looks like this:
You would replace those two lines with this:
For multipart pages, you would look for code like this:
and replace it with this:
'multipart' ) ); ?>
Go to WP-Admin -> Settings -> PageNavi for configuration.
Changing the CSS
If you need to configure the CSS style of WP-PageNavi, you can copy the pagenavi-css.css file from the plugin directory to your theme’s directory and make your modifications there. This way, you won’t lose your changes when you update the plugin.
Alternatively, you can uncheck the “Use pagenavi.css?” option from the settings page and add the styles to your theme’s style.css file directly.
Changing Class Names
There are filters that can be used to change the default class names that are assigned to page navigation elements.
Filters
wp_pagenavi_class_pages
wp_pagenavi_class_first
wp_pagenavi_class_previouspostslink
wp_pagenavi_class_extend
wp_pagenavi_class_smaller
wp_pagenavi_class_page
wp_pagenavi_class_current
wp_pagenavi_class_larger
wp_pagenavi_class_nextpostslink
wp_pagenavi_class_last
Filter Usage
// Simple Usage - 1 callback per filter
add_filter('wp_pagenavi_class_previouspostslink', 'theme_pagination_previouspostslink_class');
add_filter('wp_pagenavi_class_nextpostslink', 'theme_pagination_nextpostslink_class');
add_filter('wp_pagenavi_class_page', 'theme_pagination_page_class');
function theme_pagination_previouspostslink_class($class_name) {
return 'pagination__control-link pagination__control-link--previous';
}
function theme_pagination_nextpostslink_class($class_name) {
return 'pagination__control-link pagination__control-link--next';
}
function theme_pagination_page_class($class_name) {
return 'pagination__current-page';
}
// More Concise Usage - 1 callback for all filters
add_filter('wp_pagenavi_class_previouspostslink', 'theme_pagination_class');
add_filter('wp_pagenavi_class_nextpostslink', 'theme_pagination_class');
add_filter('wp_pagenavi_class_page', 'theme_pagination_class');
function theme_pagination_class($class_name) {
switch($class_name) {
case 'previouspostslink':
$class_name = 'pagination__control-link pagination__control-link--previous';
break;
case 'nextpostslink':
$class_name = 'pagination__control-link pagination__control-link--next';
break;
case 'page':
$class_name = 'pagination__current'
break;
}
return $class_name;
}
Development
https://github.com/lesterchan/wp-pagenavi
Credits
Plugin icon by SimpleIcon from Flaticon
Donations
I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「WP-PageNavi」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.00 | 2.00 | 2.01 | 2.02 | 2.03 | 2.10 | 2.11 | 2.20 | 2.30 | 2.31 | 2.40 | 2.50 | 2.61 | 2.72 | 2.73 | 2.74 | 2.80 | 2.81 | 2.82 | 2.83 | 2.85 | 2.86 | 2.87 | 2.88 | 2.89 | 2.90 | 2.91 | 2.92 | 2.93 | trunk | 2.89.1 | 2.93.1 | 2.93.2 | 2.93.3 | 2.93.4 | 2.94.0 | 2.94.1 | 2.94.2 | 2.94.3 | 2.94.4 | 2.94.5 |
延伸相關外掛(你可能也想知道)
WP PageNavi Style 》首先,我想感謝 Lester 'GaMerZ' Chan 和 scribu 為這個美麗的 WordPress 頁面導航外掛所做出的貢獻。, 使用此外掛你必須先安裝 Wp Pagenavi。 , 連結:分頁...。
WP Page Numbers 》使用者友善的導覽, 使用者可以輕鬆地通過頁數而非上一頁/下一頁的連結,快速找到所需的頁面。這對於 SEO(搜索引擎優化)很有好處,因為它創建了更緊密的內部...。
Simplistic page navi 》這個外掛程式的頁面列表有一個輸入框,讓你可以直接指定想要顯示的頁面編號。, 這個外掛程式有設定可以讓頁面列表反向顯示。, 你可以在每個頁面上指定樣式表...。
List category posts with pagination 》使用分頁列出分類文章外掛可讓您使用 [mycatlist] shortcode 在文章或頁面中列出分類文章。, 此 shortcode 接受分類 id,因此屬性會是 "cat = Category_ID",...。
WP-SEO-Paginate 》, 作者網站|, 外掛主頁, 用簡單明瞭的分頁導航界面取代基本的分頁樣式。WP-SEO-Paginate 是一個簡單靈活的分頁外掛,在您的 WordPress 網站上提供更好的導航...。
Custom Pagination Permalinks 》如果您想要自定義翻頁的網址, 您會發現到 WordPress 在翻頁時會固定使用網址後綴 "[..]/page/[number]/", 這個後綴無法更改, 無論是在首頁、 分類或標籤導...。
Back and Forward Button 》在網站上任何地方新增符合主題顏色和樣式的◄和►按鈕。可以替代上一頁和下一頁功能。, , 支援行動裝置, 不需要翻譯,因為它只顯示「◄」和「►」, 此外掛實際上...。
Widget Pagination 》您可以選擇要分頁顯示的(標準 WordPress)小工具,並分別設置每個小工具頁面顯示的項目。, 您還可以設置要顯示的頁數,更改上一頁/下一頁鏈接的標籤,以及讓...。
Simple Guestbook 》- 這個外掛是基於WordPress的評論功能,可以創建一個分頁輸出,只需將簡碼[simple-guestbook]插入WordPress頁面的內容即可顯示。, - 由於該外掛僅使用現有的...。
Pagination Translator 》一個簡單的外掛,允許您翻譯 WordPress 分頁的 URL(從“page”變成其他任何東西)。, 啟用此外掛後,您可以在Permalinks頁面上設置分頁。。
WP Paging Ajax 》這是一個使用 AJAX 實現分頁功能的簡易外掛。目前版本僅支援整數分頁。該外掛與所有模板兼容,不會改變文章、產品(woocommerce)或任何文章類型的存檔介面...。
View All Pages 》此外掛會在 wp_link_pages 的輸出中新增一個「所有文章頁面(All Pages)」的連結,在單一頁面上顯示所有文章頁面。。
Page Translator 》自訂 WordPress 分頁的網址。您可以將 ‘page’ 更改為任何其他內容。例如,將 ‘http://www.yourwebsite.com/page/5/’ 改為 ‘ht...。
Fix Paging 》許多人報告說 WordPress 3.1 版本更新後,會使得網站的分類和標籤分頁功能失效。這個外掛可以禁用標籤和分類的網址重定向。如果你的網站的標籤和分類分頁功能...。
AJAX Comment Pager 》這是一個針對 WordPress 2.7 或以上版本的評論分頁的 AJAX 分頁外掛。, 功能:, , 使用 AJAX 處理評論分頁, 無需任何 JavaScript 框架, , 演示:, http://www.n...。