I started this project to learn more about Next.js and how i can use WordPress headless by exposing the data via WPGraphQL plugin. I created a small app which gets the posts from a custom post type and a search that uses a local json file so it's super quick which is generated on build.
Setup a WordPress installation and add the following plugins:
-
Install Knowledge Base WP Plugin
https://github.com/ragudesign/kb-wp
-
Install WPGraphQL Plugin
https://www.wpgraphql.com/
- Clone the repo
yarn create next-app -e https://github.com/ragudesign/kb-nextjs
# or
npx create-next-app -e https://github.com/ragudesign/kb-nextjs
- Add a .env file to the root with the following:
WORDPRESS_GRAPHQL_ENDPOINT=http://wordpressite.com/graphql
To start the project locally, run:
yarn dev
# or
npm run dev
Distributed under the MIT License. See LICENSE
for more information.