Yesterday I had the pleasure of pair-programming with Daniel Olson of Shifter and we walked through the process of registering a custom connection in the WPGraphQL Schema, and writing the resolvers for it. You can watch the recording of the pair programming session below:
Category Archives: Tutorials
WPGraphQL + Gatsby Tutorial
Zac Gordon put together a group of engineers to work on a formal project, GatsbyWPThemes.com to port popular WordPress themes to Gatsby themes. Recently, Muhammad Muhsin published a tutorial showcasing how users can create a Gatsby theme using WordPress as the CMS and WPGraphQL as the API for Gatsby to consume data from. Take a …
Easy static HTML exports of your Next.js + GraphQL site
You’re here because you’d like to learn how to create static HTML exports for your Next.js site which uses GraphQL as a data source to create dynamic pages from page components. And that site may even use WPGraphQL to pull content from WordPress. Fantastic, this article will describe the simple process of doing exactly that. …
Continue reading “Easy static HTML exports of your Next.js + GraphQL site”
Preventing unauthenticated requests to your WPGraphQL API
Someone asked in the Slack channel how they could lock down the WPGraphQL endpoint so that only authenticated users could access it. Provided Solution What this does Below, I’ll walk through what this snippet does. Hook into the GraphQL request lifecycle This snippet hooks into the do_graphql_request action, which is fired when a GraphQL request …
Continue reading “Preventing unauthenticated requests to your WPGraphQL API”
Build an App Using React and the GraphQL Plugin for WordPress in ~15mins
If you keep up with tech trends, you likely already know that GraphQL is one of the newer breakout technologies that people are gushing about. It’s an open source specification created and used by Facebook’s Engineering team that can be used to push and pull data between APIs and apps. REST APIs have traditionally been …
Continue reading “Build an App Using React and the GraphQL Plugin for WordPress in ~15mins”
Querying Sticky Posts with GraphQL
Recently, a WPGraphQL user asked how to query only sticky posts with a GraphQL query. One of the great things about WPGraphQL is how customizable it is with hooks and filters, making it easy to extend the API for your needs. End goal One (of many possible) solutions would be to allow the client to specify that …
Using GraphQL Queries in PHP within your WordPress Theme or Plugin
GraphQL is most popularly known as a way to fetch data from remote sources via HTTP requests, but with WPGraphQL, you can access your local WordPress data in your plugin or theme via declarative GraphQL queries. An example use case would be a simple shortcode for a list of posts. Let’s look at how we can build …
Continue reading “Using GraphQL Queries in PHP within your WordPress Theme or Plugin”
Query Dad Jokes with WPGraphQL
If you’ve ever wanted to use GraphQL to query dad jokes, look no further. If you’re running a WordPress site, you can install the WPGraphQL plugin along with the WPGraphQL Dad Jokes plugin, and you can query for a random Dad Joke using GraphQL! The plugin uses icanhazdadjoke.com to retrieve a random dad joke. This …