KEMBAR78
Harness The Power Of ACF For Gatsby and WordPress | PPTX
Harness The Power
of ACF for Gatsby
and WordPress
@imranhsayed
To BE COVERED
Main points of discussion
⩥ Why use Gatsby with WordPress?
⩥ Gatsby Theme for Decoupled WordPress
⩥ Real world project example.
⩥ Challenges when build custom home page
with Gatsby WordPress Theme
⩥ How do we solve those challenges?
⩥ Free Example theme with the
implementation.
⩥ Free and open-source ( Both Gatsby and WordPress )
⩥ Blazing fast
⩥ Secure ( no direct connection to the database )
⩥ Development Experience ( Use modern front-end
libraries like React, GraphQL )
⩥ Content Mesh - ( Pull content from many sources )
⩥ Content Migration is easy.
Why Gatsby with WordPress
Decoupled architecture
Gatsby WordPress Theme
WordPress
wp-graphql
Using GUtenberg for
content creation
Open web
Demo
Custom Fields
⩥ Require custom data
⊳ Selectable and sortable featured posts.
⊳ Relational data
⊳ Taxonomies
⩥ Pages have interactive elements
When do we require Custom fields?
Challenges in
creating custom
Pages
⩥ Write code to create meta fields
⩥ Register Type by extending WP-GraphQL plugin
⩥ Time consuming
Solution?
WordPress
Backend
Front page
Repeatables &
flexibility
ACF Repeatables & Gallery Fields
Gutenberg + ACF
blogs
Hybrid pages
Dynamic + Static
How do we query ACF
fields in Front end?
Wp-graphQl-ACF
exposes ACF fields to the
WPGraphQL Schema
wp-graphql-acf
wp-graphql
wp-graphiql
Install & Activate the plugins on Wordpress
How do we use
ACF with GATSBY?
Demo Theme
Image
Optimization
⩥ gatsby-transformer-sharp
⊳ Creates ImageSharp nodes from image types
and provides fields for processing your
images in a variety of ways including
resizing, cropping, and creating responsive
images.
Image Optimization plugins - sharp library
⩥ gatsby-plugin-sharp
⊳ Helper plugin that exposes several image
processing functions built on the Sharp
image processing library.
⩥ gatsby-source-filesystem
⊳ Sources data from your local filesystem and
creates File nodes from files.
Image Optimization plugins
⩥ gatsby-plugin-graphql-image
⊳ Traverses a grapqhl schema sourced from the
gatsby-source-graphql plugin and generates
file nodes for use with gatsby-plugin-sharp
and gatsby-transformer-sharp.
Image Optimization plugins
Gatsby-plugin-graphql-image - query
Gatsby-plugin-graphql-image - query
result
Gatsby-plugin-graphql-image - query
result
SEO
WP-GraphQL Yoast SEO
References
⩥ https://github.com/imranhsayed/gatsby-
wordpress-themes
⩥ https://github.com/wp-graphql/
⩥ https://github.com/wp-graphql/wp-graphql-acf
⩥ hello@rtcamp.com
I am Imran Sayed
Full Stack Engineer @rtCamp
You can find me at
@imranhsayed on twitter
Thank YOU!

Harness The Power Of ACF For Gatsby and WordPress

Editor's Notes

  • #6 Since its introduction, few can argue that the Gutenberg editor has opened up and elevated the WordPress content creation experience. However, since Gutenberg dumps HTML right onto the page,when we have interactive elements like button click etc, it's not possible to run a direct DOM query on the content using React. One way out is to parse each of the blocks in order to add interactivity in the front end. However, this is a time-consuming process, and not always an option.
  • #7 This was exactly the scenario that we found ourselves in with one of our clients, Open Web (formerly SPOT.IM) They wanted to build a Gatsby-powered front end that was lightning quick, and pair it with the flexible and stable WordPress CMS on the backend. The project had a steep deadline, only 1 month between commencement & launch. So we had to find another way forward. What we came up with, and I think you will agree, is pretty stunning.