https://github.com/ozcancelik/wpgraphql-prev-next-random-post
This is a WordPress plugin that adds a new field to the GraphQL schema that allows you to query for the previous, next and random post of a given post type.
https://github.com/ozcancelik/wpgraphql-prev-next-random-post
graphql php wordpress wordpress-plugin wpgraphql wpgraphql-plugin
Last synced: about 1 month ago
JSON representation
This is a WordPress plugin that adds a new field to the GraphQL schema that allows you to query for the previous, next and random post of a given post type.
- Host: GitHub
- URL: https://github.com/ozcancelik/wpgraphql-prev-next-random-post
- Owner: ozcancelik
- Created: 2023-01-24T20:34:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-03T14:54:27.000Z (over 3 years ago)
- Last Synced: 2025-01-17T04:46:21.126Z (over 1 year ago)
- Topics: graphql, php, wordpress, wordpress-plugin, wpgraphql, wpgraphql-plugin
- Language: PHP
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WpGraphQL Previous, Next and Random Post.
This is a WordPress plugin that adds a new field to the GraphQL schema that allows you to query for the previous, next and random post of a given post type.
## Installation
Download the plugin as a zip file and install it via the WordPress admin panel. Or add the code your theme's `functions.php` file.
or
Install via git clone:
```bash
git clone https://github.com/ozcancelik/wpgraphql-prev-next-random-post.git
```
## Usage
### Previous and Next Post
```graphql
query MyQuery {
post(id: "cG9zdDox") {
id
title
previous {
id
title
}
next {
id
title
}
}
}
```
### Random Post
```graphql
query MyQuery {
randomPost {
id
title
}
}
```