[WordPress] 外掛分享: Responsive Pagination

WordPress 外掛 Responsive Pagination 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Responsive Pagination」是 2020-05-19 上架。
  • 目前有 20 個安裝啟用數。
  • 上一次更新是 2021-07-23,距離現在已有 1381 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.5.0 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 5.3 以上。
  • 有 1 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

sasikirono |

外掛標籤

mobile | pagination | responsive |

內容簡介

Responsive Pagination 外掛可讓您配置頁面分頁,以適應不同的螢幕尺寸。基於響應式網頁設計概念,您的分頁可因瀏覽器寬度不同而顯示不同。

例如,當您的網站訪客使用桌面電腦和大型螢幕時,您可能希望有較長的分頁,包含許多頁數,但當他們使用手機時,只需要簡要的 Prev 和 Next 鏈接。

當您發現您的佈景主題在分頁的響應式設計上做得不好時,您可以嘗試使用此外掛。這個外掛可讓您手動配置到所需的斷點。

兩種應用 Responsive Pagination 的不同方法

您可以選擇要應用 Responsive Pagination 的方式。

方法 A:轉換現有的分頁(無需編寫程式碼)

此方法將把佈景主題中現有的分頁轉換為響應式分頁,無需添加任何 WordPress 縮略碼或 PHP 程式碼。您只需要填寫現有分頁元素的選擇器(CSS 或 jQuery 類型選擇器)。您可以在管理設置頁面(設置 > Responsive Pagination)中輸入選擇器。

方法 B:由頭開始編程創建新分頁

此方法需要您直接在模板文件中插入 PHP 程式碼,使用 Responsive Pagination API。此方法支援使用 WP_Query 进行查询,甚至可以使用不使用 WP_Query 的更通用的内容。

Responsive Pagination API(用於編程使用)

注:此 API 部分是一個編寫響應式分頁的簡短指南。然而,有一個更容易的解決方案可以在不接觸任何程式代碼的情況下使用此外掛,這是通過在管理設置頁面中轉換您的佈景主題現有的分頁,並只提供其 CSS/jQuery 選擇器。

如果您想編寫響應式分頁,此外掛會為您新增一個可使用的新功能,可在您放置功能時呈現新分頁。

參數:

$id:(字符串)(必需)您想要創建的新分頁的 ID,格式為 kebab-case。

$args :(WP_Query | array)(必需)WP_Query 實例或包含:

$current:(整型) 當前頁面
$total:(整型) 總頁數
$urlFirstPage:(字符串)首頁 URL
$urlPattern:(字符串)使用 {pagenum} 標籤的這個分頁的 URL 模式。

備註:分頁設置和斷點配置仍從管理設置頁面配置。

範例(用於編程使用)

使用 WP_Query 在主循環中為帖子創建分頁的範例。只要在循環中使用 WP_Query,那么就可以使用此片段,甚至在自定義文章類型上也能使用。

global $wp_query; // 或者一些自定義 WP_Query 實例
if( function_exists( 'create_responsive_pagination' ) ) {
create_responsive_pagination( 'my-pagination-id', $wp_query );
}
?>

在不使用 WP_Query 的情況下,提供自己的當前頁面,總頁數,首頁 URL 和 URL 模式來創建更通用的分頁。

if( function_exists( 'create_responsive_pagination' ) ) {
create_responsive_pagination( 'my-pagination-id', array(
'current' => $my_current_page, // 在這裡輸入當前頁面
'total' => $my_total_pages, // 在這裡輸入總頁數
'urlFirstPage' => $my_url_first_page, // 在這裡輸入首頁 URL
'urlPattern' => $my_url_pattern, // 在這裡輸入使用 {pagenum} 標籤的 URL 模式。
) );
}
?>

原文外掛簡介

Responsive Pagination plugin lets you configure your paginations to adapt to different screen size. Your paginations can be shown differently based on browser width as in responsive web design concept.
For instance, you might want to have a longer pagination with many page numbers when your site visitors are using desktops and large screens, but need shorter pagination with only Prev and Next link when they’re using phones.
You may try using this plugin when you found your theme is not doing well with the responsive design on its pagination. This plugin lets you configure manually to the desired breakpoints.
Two Different Methods to Apply Responsive Pagination
You can choose the way you want to apply responsive pagination.
Method A : Convert Existing Paginations (No Coding Required)
This method will convert the existing paginations from your theme into responsive paginations without needs to add any WordPress shortcode or PHP code. You only need to fill the selectors (CSS or jQuery-like selector) of the existing pagination elements. You’ll input the selectors in Admin Settings Page (Settings > Responsive Pagination)
Method B : Create new Pagination Programmatically from Scratch
This method will need you to insert PHP code into template files directly using Responsive Pagination API. This method supports queries using WP_Query, or even something more generic without WP_Query.
Responsive Pagination API (For Programmatic Usage)
Note : This API section is a short guide for creating responsive pagination programmatically. However, there is easier solution using this plugin without touching any code – that is by converting your theme’s existing pagination from within Admin Settings Page with just providing its CSS/jQuery selector.
If you want to create responsive pagination programmatically, this plugin adds new function for you to use, which will render a new pagination where you put the function.

Parameters :

$id: (string) (required) ID for the new pagination you want to create in kebab-case format.

$args : (WP_Query | array) (required) WP_Query instance, or an associative array contains :

$current : (int) Current page
$total: (int) Total pages
$urlFirstPage : (string) URL for first page
$urlPattern: (string) URL pattern for this pagination by using {pagenum} tag.

Note : Pagination settings and Breakpoint Configurations are still configured from within Admin Settings Page.
Example (For Programmatic Usage)
Example for creating pagination for posts within main loop using WP_Query. This also works with custom post type as long as you have WP_Query within loop.

Example for creating a more generic pagination by providing your own data for current page, total pages, URL first page, and URL pattern without WP_Query.
$my_current_page, // your current page here
'total' => $my_total_pages, // your total page here
'url_first_page' => 'https://www.example.com/archives/', // URL when current page = 1
'url_pattern' => 'https://www.example.com/archives/page/{pagenum}' // the pattern using {pagenum} tag
) );
}
?>

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Responsive Pagination」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.2.0 | 1.3.0 | 1.4.0 | 1.4.1 | trunk |

延伸相關外掛(你可能也想知道)

  • Responsive Menu – Create Mobile-Friendly Menu 》這是一個高度自訂化的 WordPress 響應式選單外掛程式,擁有超過150個可自訂選項,讓您擁有22,500種組合選擇!您不需要編寫代碼或知識,只需使用簡單易用的介...。
  • WP Mobile Menu – The Mobile-Friendly Responsive Menu 》需要一個專門的手機網站體驗嗎?需要一個能讓您的手機訪客參與的手機菜單外掛嗎?, , WP Mobile Menu是最優秀的WordPress響應式手機菜單。使用任何設備(智能...。
  • WPtouch – Make your WordPress Website Mobile-Friendly 》WPtouch是一個 WordPress 插件,為您的 WordPress 網站自動添加一個簡單而優雅的行動版主題,以迎接行動訪客。建議您使用 Google 推薦的 WPtouch,它可以立即...。
  • Sidebar Widgets by CodeLights 》❗ 很抱歉,由於 SiteOrigin 的 widgets API 完全更改,CodeLights 不再支援 SiteOrigin Page Builder 的原生使用。解決方案:您仍然可以在純文字編輯器中創...。
  • WP Responsive Menu 》WP Responsive Menu是一個簡單的外掛,可以讓您在WordPress網站上快速添加高度可定制的響應式菜單,在設置頁面上直接進行自定義,無需任何編碼技能。, 查看實...。
  • Font Awesome 4 Menus 》此 WordPress 外掛能夠在不需編寫任何程式碼的情況下,將 Font Awesome 4 圖示添加到您的 WordPress 選單和網站上!您只需將 fa-(圖示名稱)添加為選單的 cl...。
  • Team Members 》這個外掛會為管理員面板增加一個「團隊」區塊,讓您可以輕鬆地在網站上展示您的員工/職員。您可以快速地將成員加入您的團隊,加入他們的照片、職位、個人簡介...。
  • Portfolio Gallery – Image Gallery Plugin 》外掛名稱:Portfolio Filter Gallery WordPress Plugin, , 外掛描述:, , 這是一個非常簡易的方法,可以為 WordPress 網站創建美麗和響應式的作品集。Portfol...。
  • Genesis Responsive Slider 》此外掛可讓您建立簡單的響應式幻燈片,顯示每篇文章的特色圖像、標題和摘要。, 它包含您的投影片的最大尺寸選項,可讓您選擇顯示文章或頁面,可以從哪個類別...。
  • BlossomThemes Social Feed 》BlossomThemes Social Feed 外掛讓您可以在您的網站上顯示 Instagram 個人資料。該外掛與 BlossomThemes 的佈景主題搭配使用效果最佳。, 您可以最多顯示 25 ...。
  • Microthemer Lite – Visual Editor to Customize CSS 》Microthemer是一個輕量級且功能強大的視覺編輯器,可以自訂網站的CSS樣式,從Google字體到響應式佈局,它適用於程式開發人員和非程式開發人員,並與Elementor...。
  • Accordion Blocks 》Accordion Blocks 是一個簡單的外掛程式,可為您的頁面新增如手風琴般的下拉式選單的 Gutenberg 區塊。, 手風琴選單可以與您的佈景主題無縫結合。不過,您可...。
  • Timeline Express 》Timeline Express 是最佳的 WordPress 時間軸外掛程式,可讓您在網站上建立美麗的動畫垂直時間軸。填入公告,設定日期,Timeline Express 會按照正確的時間順...。
  • Tabby Responsive Tabs 》, 增加一組水平標籤,在較窄的視窗時會變成手風琴, 使用 jQuery 建立標籤和手風琴, 支援同一頁面多組標籤, 使用語意化的標題和內容標記, Aria 屬性和角色有助...。
  • ShiftNav – Responsive Mobile Menu 》ShiftNav 是 WordPress 的一個很棒的行動裝置選單外掛程式。它的外觀和操作方式與像 Facebook、Gmail 等受歡迎的應用程式的本機 App 側邊拉出式選單非常相似...。

文章
Filter
Apply Filters
Mastodon