- Notifications
You must be signed in to change notification settings - Fork18
valu-digital/wp-graphql-offset-pagination
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Adds traditional offset pagination support to WPGraphQL. This is useful onlywhen you need to implement:
- Numbered links to the "pages"
- Ordering with custom SQL
- Read thetutorial
- You should read it even if don't plan to use this plugin as it teachesyou a lot about WPGraphQL internals!
You should not use this plugin if you can avoid it. The cursors in thewp-graphql core are faster and more efficient although this plugin should performcomparatively to a traditional WordPress pagination implementation.
This plugin implements offset pagination for post object (build-in and customones), content nodes and user connections. This means there's no WooCommerce for examplebut checkoutthis issue if you are interested in one.
PRs welcome for term connections. SeeCONTRIBUTING.md.
queryPosts {posts(where: {offsetPagination: {size:10,offset:10 } }) {pageInfo {offsetPagination { # Boolean whether there are more nodes in this connection. # Eg. you can increment offset to get more nodes. # Use this to implement "fetch more" buttons etc.hasMore # True when there are previous nodes # Eg. you can decrement offset to get previous nodes.hasPrevious # Get the total node count in the connection. Using this # field activates total calculations which will make your # queries slower. Use with caution.total } }nodes {title } }}
The where argument is the same forcontentNodes andusers.
Use must have WPGraphQL v0.8.4 or later installed.
If you use composer you can install it from Packagist
composer require valu/wp-graphql-offset-paginationOtherwise you can clone it from Github to your plugins using the stable branch
cd wp-content/pluginsgit clone --branch stable https://github.com/valu-digital/wp-graphql-offset-pagination.gitThis a reimplementation ofdarylldoyle/wp-graphql-offset-pagination byDaryll Doyle. The API is bit different but this one has unit&integrationtests and support for latest WPGraphQL.
About
Adds traditional offset pagination support to WPGraphQL
Topics
Resources
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.