Adds traditional custom pagination support to WPGraphQL. This is useful only when you need to implement:
- Numbered links to the "pages"
You should not use this plugin if you can avoid it. The cursors in the wp-graphql core are faster and more efficient although this plugin should perform comparatively to a traditional WordPress pagination implementation.
This plugin implements offset pagination for post object (build-in and custom ones), content nodes, category, tag, and user connections.
PRs welcome.
query Posts {
posts(where: {customPagination: {paged: 2, posts_per_page: 10}}) {
pageInfo {
customPagination {
total
hasPreviousPage
hasNextPage
previousPage
currentPage
nextPage
totalPages
}
}
nodes {
title
}
}
}
The where argument is the same for contentNodes
and users
.
Use must have WPGraphQL v0.8.4 or later installed.
You can clone it from Github to your plugins using the stable branch
cd wp-content/plugins
git clone --branch stable https://github.com/agusmu/wp-graphql-custom-pagination.git
This a reimplementation of
- darylldoyle/wp-graphql-offset-pagination by Daryll Doyle.
- valu-digital/wp-graphql-offset-pagination by Valu Digital Oy.