[wordpress插件] Carbon Pagination碳分页

wordpress 插件 文章 2020-03-16 21:10 622 0 全屏看文

AI助手支持GPT4.0

评分
100
描述

A handy WordPress library for building all kinds of paginations.

一个方便的WordPress库,用于构建各种分页。

Provides the theme and plugin developers an easy way to build and implement highly customizable paginations, specifically tailored to their needs.

为主题和插件开发人员提供了一种轻松的方式来构建和实现高度可定制的分页,专门针对其需求量身定制。

This plugin supports 4 types of pagination (you can easily extend the library if you need to create a new type of pagination):

此插件支持4种分页(如果您需要创建新的分页类型,则可以轻松扩展库):

Posts

帖子

The most common pagination type.

最常见的分页类型。

Used for paginating through post listings in non-singular context – usually on the posts page, on all types of archives and on search results.

用于在非单一上下文中通过帖子列表进行分页–通常在帖子页面,所有类型的档案库和搜索结果上。

This pagination uses the current global $wp_query, which means you can use it together with your custom query loops as well.

此分页使用当前的全局 $ wp_query ,这意味着您也可以将其与自定义查询循环一起使用。

Post

发布

Used for paginating through posts in singular context.

用于在单个上下文中通过帖子进行分页。

Usually used on single posts – single.php, but can be used to paginate through entries of any registered post type (including built-in ones like page).

通常用于单个帖子– single.php ,但可用于对任何已注册帖子类型的条目(包括诸如 page 之类的内置帖子)进行分页。

Uses the global $post to determine the current post and paginates through all of the rest posts of the same post type.

使用全局 $ post 来确定当前帖子,并通过同一帖子类型的所有其余帖子进行分页。

You can filter the query that retrieves all posts by using the carbon_pagination_post_pagination_query filter – please refer to the Actions & Filters section for more information.

您可以使用 carbon_pagination_post_pagination_query 过滤器过滤检索所有帖子的查询-有关更多信息,请参阅操作和过滤器部分。

Comments

评论

Used for comments pagination on a given post.

用于给定帖子的评论分页。

Usually used on single.php when comments pagination is enabled in Settings -> Discussion, but can be used on posts in non-singular context as well.

设置->讨论中启用了注释分页时,通常在 single.php 上使用,但也可以在非单一上下文中使用。

Of course you would have to do the following to be able to list comments in non-singular loops:

当然,您必须执行以下操作才能在非单一循环中列出评论:

global $withcomments;

 全局$ withcomments;

$withcomments = true;

$ withcomments = true;

This pagination type supports a comments pagination on the comments of a post of any registered post type.

此分页类型支持对任何已注册帖子类型的帖子的评论进行评论分页。

Custom

自定义

Used for creating custom flexible paginations.

用于创建自定义的灵活分页。

You can specify the total number of pages and the current page by yourself.

您可以自己指定页面总数和当前页面。

Also, you’d have to specify the query var that is used to build the pagination links (by default page is used).

此外,您还必须指定用于构建分页链接的查询var(默认情况下,使用 page )。

If you don’t specify a current page and total number of pages, this pagination type can be used for content pagination on a single post of any post type (including page).

如果您未指定当前页面和页面总数,则此分页类型可用于任何帖子类型(包括 page )的单个帖子上的内容分页。

Content can be paginated by using the default WordPress quicktag.

可以使用默认的WordPress <!-nextpage-> quicktag对页面进行分页。

If you need a more complex custom pagination, you’d probably want to extend this pagination type – it is being represented by the Carbon_Pagination_Custom class.

如果您需要更复杂的自定义分页,则可能需要扩展此分页类型-它由 Carbon_Pagination_Custom 类表示。

Configuration

配置

The following example is the most basic way to display a posts pagination (see Configuration Options for all types of pagination), using the default options:

以下示例是使用默认选项显示帖子分页的最基本方法(有关所有类型的分页,请参阅配置选项):

  <?php carbon_pagination('posts'); 

?>

?>

If using Carbon Pagination as a plugin, it would be best to check if the function exists:

如果使用Carbon Pagination作为插件,则最好检查该功能是否存在:

  <?php

if ( function_exists('carbon_pagination') ) {    

如果(function_exists('carbon_pagination')){    

carbon_pagination('posts');

carbon_pagination('posts');

}

}

?>

?>

The carbon_pagination() function is a wrapper around the Carbon_Pagination_Presenter class, which handles pagination presentation.

carbon_pagination()函数是对 Carbon_Pagination_Presenter 类的包装,该类处理分页显示。

Which means you can also do the above this way:

这意味着您也可以通过以下方式进行上述操作:

  <?php Carbon_Pagination_Presenter :: display('posts'); 

?>

?>

Of course, if using Carbon Pagination as a plugin, it would be best to check if the class exists:

当然,如果使用Carbon Pagination作为插件,则最好检查该类是否存在:

  <?php

if ( class_exists('Carbon_Pagination_Presenter') ) {    

如果(class_exists('Carbon_Pagination_Presenter')){    

Carbon_Pagination_Presenter::display('posts');

Carbon_Pagination_Presenter :: display('posts');

}

}

?>

?>

For additional configuration and developer documentation, you can visit the Github repository:

有关其他配置和开发人员文档,您可以访问Github存储库:

https://github.com/2createStudio/carbon-pagination

https://github.com/2createStudio/carbon-pagination

Ideas and bug reports

想法和错误报告

Any ideas for new functionality that users would benefit from are welcome.

欢迎任何有关用户将从中受益的新功能的想法。

If you have an idea for a new feature, or you want to report a bug, feel free to do it here in the Support tab, or you can do it at the Github repository of the project:

如果您有新功能的想法,或者想要报告错误,请随时在“支持”选项卡中进行操作,或者在项目的Github存储库中进行操作:

https://github.com/2createStudio/carbon-pagination

https://github.com/2createStudio/carbon-pagination

安装步骤

    1. Install Carbon Pagination either via the WordPress.org plugin directory, or by uploading the files to your server.
    2. 通过WordPress.org插件目录或通过将文件上传到服务器来安装Carbon Pagination。

    3. Activate the plugin.
    4. 激活插件。

    5. That’s it.

    6. 就是这样。

      You’re ready to go!

      您准备好出发了!

      Please, refer to the Configuration section for examples and usage information.

    7. 请参阅“配置”部分以获取示例和用法信息。

下载地址
https://downloads.wordpress.org/plugin/carbon-pagination.1.1.3.zip
-EOF-

AI助手支持GPT4.0