https://github.com/armandphilippot/wp-graphql-content-stats
Add some stats to WPGraphQL: total posts, word count and estimated reading time.
https://github.com/armandphilippot/wp-graphql-content-stats
wordpress wordpress-plugin wpgraphql wpgraphql-plugin
Last synced: 20 days ago
JSON representation
Add some stats to WPGraphQL: total posts, word count and estimated reading time.
- Host: GitHub
- URL: https://github.com/armandphilippot/wp-graphql-content-stats
- Owner: ArmandPhilippot
- License: gpl-2.0
- Created: 2022-01-24T11:29:06.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-11T10:30:59.000Z (almost 3 years ago)
- Last Synced: 2025-03-13T07:42:36.591Z (about 1 year ago)
- Topics: wordpress, wordpress-plugin, wpgraphql, wpgraphql-plugin
- Language: PHP
- Homepage:
- Size: 200 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# WPGraphQL Content Stats
Add some stats to WPGraphQL: total posts, word count and estimated reading time.
## Introduction
This WordPress plugin adds some new fields to WPGraphQL:
- a `total` field is added to `pageInfo`: it contains the total of found posts or found users (depending on `WP_Query` type).
- an `info` field is added to `ContentNode` (used by posts for example): it contains itself two fields:
- `readingTime`: an estimated reading time,
- `wordsCount`: the number of words in the post content.
The `readingTime` field offers two formats:
- `minutes`: the returned number is a rounded estimate of reading time in minutes.
- `seconds`: the returned number is a rounded estimate of reading time in seconds. It allows you to add some extra logic in frontend to display the reading time (displaying minutes and seconds for example).
## Requirements
- [WordPress](https://wordpress.org/)
- [WPGraphQL](https://github.com/wp-graphql/wp-graphql)
## License
This project is open source and available under the [GPL2.0-or-later License](./LICENSE).