/wordpress-headless-next

Sample implementation for WP + Next headless

Primary LanguagePHP

Headless WordPres + Next sample

This is a demo project to show how to use Next.js with WordPress as a headless CMS.

It uses GraphQL to fetch data from WordPress and render it using Next.js.

Prerequisites

  • Docker ( Install here )
  • Node.js 20.x or higher ( Install here )

Getting Started

1. Clone the repository

git clone https://github.com/ilasw/wordpress-headless-next.git
cd wordpress-headless-next

2. Start the WordPress server

docker-compose up

Open http://localhost:8000 with your browser to see the result, and http://localhost:8000/wp-admin to access the WordPress setup.

Note: in the .wordpress folder you will find a volume that contains all the wp-content/plugins/ folder, which contains the WP plugins.

wp-graphql and wpgraphql-blocks are mandatory plugins.

3. Start the Next.js server

cd next
npm install
npm run dev

Open http://localhost:3000 with your browser to see the result.


Liked this project?

  • Star the repo and share it with others
  • Contact me for any questions or suggestions
  • Hire me for your next project: lucapagliaro.it