Title: Responsive Pagination
Author: Bagus Sasikirono
Published: <strong>2020 年 5 月 20 日</strong>
Last modified: 2021 年 7 月 23 日

---

搜索插件

![](https://ps.w.org/responsive-pagination/assets/banner-772x250.png?rev=2344847)

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://ps.w.org/responsive-pagination/assets/icon.svg?rev=2308650)

# Responsive Pagination

 作者：[Bagus Sasikirono](https://profiles.wordpress.org/sasikirono/)

[下载](https://downloads.wordpress.org/plugin/responsive-pagination.1.4.1.zip)

 * [详情](https://cn.wordpress.org/plugins/responsive-pagination/#description)
 * [评价](https://cn.wordpress.org/plugins/responsive-pagination/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/responsive-pagination/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/responsive-pagination/#developers)

 [支持](https://wordpress.org/support/plugin/responsive-pagination/)

## 描述

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.

    ```
    <?php create_responsive_pagination( $id, $args ) ?>
    ```

Parameters :

 * `$id`: _(string)_ _(required)_ ID for the new pagination you want to create in
   _kebab-case_ format.
 * `$args` : _(WP\_Query | array)_ _(required)_ [WP_Query](https://developer.wordpress.org/reference/classes/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.

    ```
    <?php
      global $wp_query;   // or some custom WP_Query instance
      if( function_exists( 'create_responsive_pagination' ) ) {
          create_responsive_pagination( 'my-pagination-id', $wp_query );
      }
    ?>
    ```

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_.

    ```
    <?php
      if( function_exists( 'create_responsive_pagination' ) ) {
          create_responsive_pagination( 'my-pagination-id', array(
            'current'         => $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
          ) );
      }
    ?>
    ```

## 屏幕截图

 * [[
 * Pagination example on Desktop
 * [[
 * Pagination example on Tablet
 * [[
 * Pagination example on Phone
 * [[
 * Admin – Convert Paginations
 * [[
 * Admin – Pagination Settings
 * [[
 * Admin – Pagination Settings (Breakpoint Configurations)

## 安装

The installation is pretty standard, just like any other plugins.

 1. install the plugin through the WordPress admin on ‘Plugins’ screen directly, or
    upload the plugin files to the `/wp-content/plugins/responsive-pagination` directory.
 2. Activate the plugin through the ‘Plugins’ screen in WordPress admin.
 3. Use “Settings > Responsive Pagination” screen within WordPress admin to configure
    the plugin.

## 常见问题

### Where can I found the Admin Settings Page

In the admin, go to “Settings > Responsive Pagination”

### What is “320px and up”, “720px and up”, etc ?

Those are the breakpoints you’ll want to configure. Each denotes the minimum width
of viewport where the corresponding configuration will be applied until the next
breakpoint. The highest breakpoint configuration will be applied for all bigger 
viewport.

For instance, if there are 3 breakpoints (320px, 720px, and 1024px), then

 * “320px and up” configuration is applied to viewport width of 320px – 719px
 * “720px and up” configuration is applied to viewport width of 720px – 1023px.
 * “1024px and up” configuration is applied to viewport width of 1024px and more

### What is “tags” ?

A tag in Responsive Pagination is like a variable where it holds a value and will
be rendered with the actual value. `{current}` and `{total}` are the example of 
tags.

So, if the current page is 5 and total page is 12, then `"Page {current} of {total}"`
will render “Page 5 of 12”.

### My pagination is responsive now, but I want to customize it more

If you want to apply more custom styling, you can set additional class to the components
from Admin Settings, and apply manual CSS.

## 评价

![](https://secure.gravatar.com/avatar/6981295cd810f036dc2488edb93612d897f51454f5456611d5b559056cbbe54d?
s=60&d=retro&r=g)

### 󠀁[Finally!](https://wordpress.org/support/topic/nice-plugin-keep-going/)󠁿

 [Bunderan 11 Store](https://profiles.wordpress.org/bunderan11/) 2020 年 5 月 22
日

Finally we can configure our responsive pagination, instead of just letting our 
theme decide it for us. Nice plugin, keep going.. Thanks!

 [ 阅读所有1条评价 ](https://wordpress.org/support/plugin/responsive-pagination/reviews/)

## 贡献者及开发者

「Responsive Pagination」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Bagus Sasikirono ](https://profiles.wordpress.org/sasikirono/)

[帮助将「Responsive Pagination」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/responsive-pagination)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/responsive-pagination/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/responsive-pagination/)，或通过[RSS](https://plugins.trac.wordpress.org/log/responsive-pagination/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/responsive-pagination/)。

## 更新日志

#### 1.4.1

 * Fix: Responsive issue on Firefox in 1 pixel below lowest breakpoint

#### 1.4.0

 * Feature : Take approach to avoid theme styling interference as possible
 * Improvement: Breakpoint Configurations now in separate tab
 * Improvement: Change in Pagination Settings looks
 * Improvement: Active vertical menu style when in focus
 * Improvement: Active vertical menu go to right tab after adding & removing breakpoints
 * Improvement: Add footer signature

#### 1.3.0

 * Feature: Introduce visual styling feature
 * Feature: Different items width for every component in every breakpoint (pagenumbers,
   prevNext link, and firstLast link)
 * Feature: Different items height in every breakpoints
 * Feature: Different space between items (gutter) in every breakpoints
 * Tweak: Pagination settings initial values

#### 1.2.0

 * First public release.

## 额外信息

 *  版本 **1.4.1**
 *  最后更新：**5 年前**
 *  活跃安装数量 **10+**
 *  WordPress 版本 ** 3.5.0 或更高版本 **
 *  已测试的最高版本为 **5.8.13**
 *  PHP 版本 ** 5.3 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/responsive-pagination/)
 * 标签
 * [mobile](https://cn.wordpress.org/plugins/tags/mobile/)[pagination](https://cn.wordpress.org/plugins/tags/pagination/)
   [responsive](https://cn.wordpress.org/plugins/tags/responsive/)
 *  [高级视图](https://cn.wordpress.org/plugins/responsive-pagination/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  1 条 5 星评价     ](https://wordpress.org/support/plugin/responsive-pagination/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/responsive-pagination/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/responsive-pagination/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/responsive-pagination/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/responsive-pagination/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/responsive-pagination/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/responsive-pagination/reviews/)

## 贡献者

 *   [ Bagus Sasikirono ](https://profiles.wordpress.org/sasikirono/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/responsive-pagination/)