Giter Club home page Giter Club logo

gatsby-wordpress-themes's Introduction

Project Status: Active. code style: prettier Download counter

  • A Gatsby theme for WordPress, using Decoupled Architecture.
  • Front end in React
  • Backend in WordPress.
gatsby theme phoenix hero image

*** πŸ‘¨β€πŸ’» Please star my repo to support my work πŸ™ ***

πŸ”₯ Features

  1. Uses React with Gatsby ( Blazing Fast )
  2. PWA ( Works Offline )
  3. Image Optimization ( blur effect )
  4. ACF
  5. GraphQL ( with wp-graphql on WordPress )
  6. Blog Page with Pagination
  7. Offline Search Feature
  8. Categories, Archive Page, Custom Home Page
  9. Custom Widgets, Menus
  10. Yoast seo support
  11. Supports Post and Page building with Elementor

🌐 Live Demo

πŸ‘¨β€πŸ’» Maintainer

Name Github Username
Imran Sayed @imranhsayed

πŸš€ Set Up

Gatsby Setup

  • Rename .env-example in site directory file to .env and add the following, in this site directory of this repo.
  • Also set the GATSBY_ELEMENTOR_SUPPORT and GATSBY_SIDEBAR if you would like the theme to support page and post building with elementor and sidebar.
GATSBY_WORDPRESS_SITE_URL=xxx
FRONTEND_URL=xxx # Set this to http://localhost:3000 for development and your live front-end gatsby url for production.
GATSBY_ELEMENTOR_SUPPORT=true
GATSBY_SIDEBAR=false

WordPress Setup

  1. On your WordPress site, download, Upload and activate all the plugins from wordpress/plugins folder of this repo, into your WordPress Site.

a. Headless CMS b. wp-graphql c. wp-graphiql d. ACF WordPress plugin e. wp-graphql-acf f. Yoast-SEO g. wp-graphql-yoast-seo

    • Set Header menu as HCMS Header Menu

    • Set Footer menu as HCMS Footer Menu
  1. You can also set text widgets in #HCMS Footer #1 and #HCMS Footer #2 under Appearance > Widgets in WordPress.

  2. Import all the ACF data from wordpress/acf-data json file of this repo, into WordPress by going to WordPress Dashboard > Custom Fields > Tools > Import

  3. Create a Home Page ( if there isn't one already )and make sure you have a home page and Location rule is set to Home page.

  4. Add the ACF required data on the Home page from WordPress Dashboard.

  5. If isn't already set your site title, description and logo from WordPress customizer.

Open the source code and start editing!

npm run dev

Your site is now running at http://localhost:8000!

Note: You'll also see a second link: http://localhost:8000/___graphql. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the Gatsby tutorial.

πŸš€ Development

  • Navigate into site’s directory.
yarn install      # Run this for the first time.
npm run dev      # During development.
npm run build    # When ready for production.

πŸ“• Storybook:

For Storybook:

  • cd package/gatsby-wordpress-theme-phoenix
  • npm run storybook

πŸ“¦ Adding/Removing a new package to site folder

yarn workspace site add package-name yarn workspace site remove package-name

πŸ“¦ Adding/Removing a new package to gatsby-wordpress-theme-phoenix folder

yarn workspace gatsby-wordpress-theme-phoenix add package-name yarn workspace gatsby-wordpress-theme-phoenix remove package-name

🧐 What's inside?

A quick look at the top-level files and directories you'll see in a Gatsby project.

.
β”œβ”€β”€ node_modules
β”œβ”€β”€ demos
β”œβ”€β”€ packages
β”œβ”€β”€ src
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .site
β”œβ”€β”€ gatsby-browser.js
β”œβ”€β”€ gatsby-config.js
β”œβ”€β”€ gatsby-node.js
β”œβ”€β”€ gatsby-ssr.js
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
└── README.md
  1. /node_modules: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.

  2. /src: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. src is a convention for β€œsource code”.

  3. .gitignore: This file tells git which files it should not track / not maintain a version history for.

  4. .prettierrc: This is a configuration file for Prettier. Prettier is a tool to help keep the formatting of your code consistent.

  5. gatsby-browser.js: This file is where Gatsby expects to find any usage of the Gatsby browser APIs (if any). These allow customization/extension of default Gatsby settings affecting the browser.

  6. gatsby-config.js: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the config docs for more detail).

  7. gatsby-node.js: This file is where Gatsby expects to find any usage of the Gatsby Node APIs (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.

  8. gatsby-ssr.js: This file is where Gatsby expects to find any usage of the Gatsby server-side rendering APIs (if any). These allow customization of default Gatsby settings affecting server-side rendering.

  9. LICENSE: Gatsby is licensed under the MIT license.

  10. package-lock.json (See package.json below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. (You won’t change this file directly).

  11. package.json: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.

  12. README.md: A text file containing useful reference information about your project.

Useful Links

  1. Setting workspaces with yarn for theme development
  2. Installing a gatsby theme and setting it up.

Deployment

With vercel

  • Signup on vercel.com

  • Click on Import Project and then add the configurations.

  • On vercel, make sure you add these from settings of the project:

From CLI:

  • npm i -g vercel

  • Now in the project root run vercel

  • Add the following configurations

  • build command: npm run build
  • output directory: site/public
  • development command: npm run dev
  • root directory: /

Theme on npm

gatsby-wordpress-theme-phoenix

gatsby-wordpress-themes's People

Contributors

dependabot[bot] avatar imranhsayed avatar mahvash-fatima avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gatsby-wordpress-themes's Issues

Cannot read property 'HWGraphQL' of undefined

Hi :)

Had no problems 1 week earlier while running your theme, but since today I can't quite make it work.
It keeps crashing when creating the pages.

I have these 2 errors :
Cannot query field "content" on type "hwgraphql_Page".
gatsby-wordpress-theme-phoenix threw an error while running the createPages lifecycle

And I didn't change anything...

This theme is awesome by the way ! Can't wait to make my way through it !

Kind regards,
Prisca

Style error on build

Running npm run develop and getting this error any idea's where I've gone wrong

ERROR #98123 WEBPACK

Generating development JavaScript bundle failed

            border: 1px solid $gray-300;
               ^
  Undefined variable: "$gray-300".
  in C:\VS\my-gatsby-project\node_modules\@wordpress\block-library\src\calendar\style.scss (line 7, column 21)

File: node_modules\gatsby-wordpress-theme-phoenix\src\components\home\feature-posts\style.scss

Plugin could not be activated because it triggered a fatal error.

I am getting this error when activating headless-cms plugin, can you please take look at it?
My set up, Wordpress 5.4.2, PHP 7.4.7 running locally using Laragon.

Plugin could not be activated because it triggered a fatal error.

Fatal error: Uncaught Error: Class 'Headless_CMS\Features\Inc\Plugin' not found in C:\Utilities\laragon\www\smrwp\wp-content\plugins\headless-cms\headless-cms.php:33 Stack trace: #0 C:\Utilities\laragon\www\smrwp\wp-content\plugins\headless-cms\headless-cms.php(36): headless_cms_features_plugin_loader() #1 C:\Utilities\laragon\www\smrwp\wp-admin\includes\plugin.php(2255): include('C:\Utilities\la...') #2 C:\Utilities\laragon\www\smrwp\wp-admin\plugins.php(177): plugin_sandbox_scrape('headless-cms/he...') #3 {main} thrown in C:\Utilities\laragon\www\smrwp\wp-content\plugins\headless-cms\headless-cms.php on line 33

TypeError: _props$pageContext.page is null

TypeError: _props$pageContext.page is null
FrontPage
node_modules/gatsby-wordpress-theme-phoenix/src/templates/front-page/index.js:10

This is shown at the browser (no error at gatsby server).
It seems that the wordpress content is not properly set.

Regarding point 6 of installation:
6 - Add the ACF required data on the Home page from WordPress Dashboard.
This is not much precise. I've setup main page, menus and some posts, but something could be missing.

In order to check what the problem is, I think it would be fine if you can provide a backup of your wordpress demo site (posts, pages, images, etc.) so we can reproduce exactly your site for testing.

Thx

warn ESLintError:

Are these warnings something to be concerned about?

You can now viewosite in the browser.
β €
  http://localhost:8000/
β €
View GraphiQL, an in-browser IDE, to explore your site's data and schema
β € Building development bundle
  http://localhost:8000/___graphql
β €
Note that the development build is not optimized.
To create a production build, use gatsby build
β €
warn ESLintError: 
C:\dev\gatsby-wordpress-themes\packages\gatsby-wordpress-theme-phoenix\src\components\footer\index.js
  30:8   warning  'socialIcons' is assigned a value but never used
                   no-unused-vars
  74:42  warning  Using target="_blank" without rel="noreferrer" is a security risk: see
https://html.spec.whatwg.org/multipage/links.html#link-type-noopener  react/jsx-no-target-blank

warniESLintError:
C:\dev\gatsby-wordpress-themes\packages\gatsby-wordpress-theme-phoenix\src\components\home\client-search\index.js
  126:13  warning  'posts' is assigned a value but never used  no-unused-vars

βœ– 1 problem (0 errors, 1 warning)

warniESLintError:
C:\dev\gatsby-wordpress-themes\packages\gatsby-wordpress-theme-phoenix\src\components\home\search\index.js
  7:8  warning  'SearchBackgroundImg' is defined but never used  no-unused-vars

βœ– 1 problem (0 errors, 1 warning)

warniESLintError:
C:\dev\gatsby-wordpress-themes\packages\gatsby-wordpress-theme-phoenix\src\components\page\index.js
   3:8  warning  'Img' is defined but never used               no-unused-vars
  13:8  warning  'imgData' is assigned a value but never used  no-unused-vars

βœ– 2 problems (0 errors, 2 warnings)

success Building development bundle - 12.703s

A question of static

So I understand Gatsby is a way to make a WordPress site static....

However, this doesn't make things easier for a bootstrap developer to design unless he know React....

So, My question is....

Isn't it much easier to "Just" make one custom meta field call HTML, and do a site scrap to custom meta field on publish.
This will store static content of the page into an custom meta field.
Then load the static content into a REACT headless WordPress BLANK theme.
This will also allow the user to add whatever plugin s/he wants, because the resulted output is static html.

Would that work better?

build fails on style.scss

Generating development JavaScript bundle failed
border: 1px solid $gray-200;
^
Undefined variable: "$gray-200".
in /home/dean/projects/tutorials/phoenix/node_modules/@wordpress/block-library/src/calendar/style.scss (line 7, column 21)

File: node_modules/gatsby-wordpress-theme-phoenix/src/components/header/style.scss

Hm

I made exactly the same stuff like your readme but get this error on: site/ npm run dev

"gatsby-wordpress-theme-phoenix" threw an error while running the createPages lifecycle:

Cannot read property 'HWGraphQL' of undefined

8 | // Create all pages.
9 | exports.createPages = async ( { actions, graphql } ) => {

10 | await createAllPages( { actions, graphql } );
| ^
11 | await createAllPosts( { actions, graphql } );
12 | await createFrontPage( { actions, graphql } );
13 | await createBlogPage( { actions, graphql } );

File: ../packages/gatsby-wordpress-theme-phoenix/gatsby-node.js:10:2

Cannot query field "altText" on type "hwgraphql_NodeWithFeaturedImageToMediaItemConnectionEdge".

I am receiving below error when running : 'npm run develop' , specifically
Cannot query field "altText" on type "hwgraphql_NodeWithFeaturedImageToMediaItemConnectionEdge".
and

error Generating development JavaScript bundle failed

encinoe@web:~/my-gatsby-project$ npm run develop

[email protected] develop /home/encino-emergency-dentist.com/my-gatsby-project
gatsby develop

success open and validate gatsby-configs - 0.041s
success load plugins - 1.801s
success onPreInit - 0.118s
success initialize cache - 0.020s
success copy gatsby files - 0.089s
success onPreBootstrap - 0.031s
success createSchemaCustomization - 0.027s
success Checking for changed pages - 0.003s
success source and transform nodes - 7.512s
Found schema 'hwgraphql', traversing for fields with name 'sourceUrl'
success building schema - 1.759s
error There was an error in your GraphQL query:

Cannot query field "altText" on type "hwgraphql_NodeWithFeaturedImageToMediaItemConnectionEdge".

If you don't expect "altText" to exist on the type "hwgraphql_NodeWithFeaturedImageToMediaItemConnectionEdge" it is most likely a typo.
However, if you expect "altText" to exist there are a couple of solutions to common problems:

  • If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
  • The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
  • You want to optionally use your field "altText" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "hwgraphql_NodeWithFeaturedImageToMediaItemConnectionEdge":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
error There was an error in your GraphQL query:

Cannot query field "sourceUrl" on type "hwgraphql_NodeWithFeaturedImageToMediaItemConnectionEdge".

If you don't expect "sourceUrl" to exist on the type "hwgraphql_NodeWithFeaturedImageToMediaItemConnectionEdge" it is most likely a typo.
However, if you expect "sourceUrl" to exist there are a couple of solutions to common problems:

  • If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
  • The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
  • You want to optionally use your field "sourceUrl" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "hwgraphql_NodeWithFeaturedImageToMediaItemConnectionEdge":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
error There was an error in your GraphQL query:

Cannot query field "sourceUrlSharp" on type "hwgraphql_NodeWithFeaturedImageToMediaItemConnectionEdge".

If you don't expect "sourceUrlSharp" to exist on the type "hwgraphql_NodeWithFeaturedImageToMediaItemConnectionEdge" it is most likely a typo.
However, if you expect "sourceUrlSharp" to exist there are a couple of solutions to common problems:

  • If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
  • The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
  • You want to optionally use your field "sourceUrlSharp" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "hwgraphql_NodeWithFeaturedImageToMediaItemConnectionEdge":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
error "gatsby-wordpress-theme-phoenix" threw an error while running the createPages lifecycle:

Cannot read property 'HWGraphQL' of undefined

8 | // Create all pages.
9 | exports.createPages = async ( { actions, graphql } ) => {

10 | await createAllPages( { actions, graphql } );
| ^
11 | await createAllPosts( { actions, graphql } );
12 | await createFrontPage( { actions, graphql } );
13 | await createBlogPage( { actions, graphql } );

TypeError: Cannot read property 'HWGraphQL' of undefined

  • pages.js:64
    [my-gatsby-project]/[gatsby-wordpress-theme-phoenix]/create-pages/pages.js:64:50

  • pages.js:61 fetchPosts
    [my-gatsby-project]/[gatsby-wordpress-theme-phoenix]/create-pages/pages.js:61:10

  • pages.js:71 module.exports
    [my-gatsby-project]/[gatsby-wordpress-theme-phoenix]/create-pages/pages.js:71:2

  • gatsby-node.js:10 Object.exports.createPages
    [my-gatsby-project]/[gatsby-wordpress-theme-phoenix]/gatsby-node.js:10:2

  • api-runner-node.js:460 runAPI
    [my-gatsby-project]/[gatsby]/src/utils/api-runner-node.js:460:16

  • From previous event:

  • api-runner-node.js:589 Promise.catch.decorateEvent.pluginName
    [my-gatsby-project]/[gatsby]/src/utils/api-runner-node.js:589:9

  • From previous event:

  • api-runner-node.js:588
    [my-gatsby-project]/[gatsby]/src/utils/api-runner-node.js:588:14

  • timers.js:461 processImmediate
    internal/timers.js:461:21

  • From previous event:

  • api-runner-node.js:561
    [my-gatsby-project]/[gatsby]/src/utils/api-runner-node.js:561:13

  • From previous event:

  • api-runner-node.js:477 module.exports
    [my-gatsby-project]/[gatsby]/src/utils/api-runner-node.js:477:3

  • create-pages.ts:25 createPages
    [my-gatsby-project]/[gatsby]/src/services/create-pages.ts:25:9

  • interpreter.js:722 Interpreter.exec
    [my-gatsby-project]/[xstate]/lib/interpreter.js:722:27

  • interpreter.js:204 Interpreter.execute
    [my-gatsby-project]/[xstate]/lib/interpreter.js:204:22

  • interpreter.js:224 Interpreter.update
    [my-gatsby-project]/[xstate]/lib/interpreter.js:224:18

  • interpreter.js:125
    [my-gatsby-project]/[xstate]/lib/interpreter.js:125:23

  • scheduler.js:60 Scheduler.process
    [my-gatsby-project]/[xstate]/lib/scheduler.js:60:13

  • scheduler.js:44 Scheduler.schedule
    [my-gatsby-project]/[xstate]/lib/scheduler.js:44:14

  • interpreter.js:121 Interpreter.send
    [my-gatsby-project]/[xstate]/lib/interpreter.js:121:29

  • interpreter.js:840 actor.id
    [my-gatsby-project]/[xstate]/lib/interpreter.js:840:23

info Total nodes: 66, SitePage nodes: 1 (use --verbose for breakdown)
failed createPages - 0.457s
success Checking for changed pages - 0.001s
success createPagesStatefully - 0.141s
success update schema - 0.031s
success write out redirect data - 0.002s
success Build manifest and related icons - 0.173s
success onPostBootstrap - 0.176s
info bootstrap finished - 20.418s
success onPreExtractQueries - 0.001s
success extract queries from components - 1.035s
success write out requires - 0.203s
success run static queries - 0.824s - 2/2 2.43/s
success run page queries - 0.022s - 1/1 45.43/s
error Generating development JavaScript bundle failed

            **width: calc(25% - #{ $button-margin });**
                                   ^
  Undefined variable: "$button-margin".
  in /home/encino-emergency-dentist.com/my-gatsby-project/node_modules/@wordpress/block-library/src/button/style.scss (line 46, column 41)

error Generating development JavaScript bundle failed

            width: calc(25% - #{ $button-margin });
                                   ^
  Undefined variable: "$button-margin".
  in /home/encino-emergency-dentist.com/my-gatsby-project/node_modules/@wordpress/block-library/src/button/style.scss (line 46, column 41)

error Generating development JavaScript bundle failed

            width: calc(25% - #{ $button-margin });
                                   ^
  Undefined variable: "$button-margin".
  in /home/encino-emergency-dentist.com/my-gatsby-project/node_modules/@wordpress/block-library/src/button/style.scss (line 46, column 41)

failed Building development bundle - 13.442s

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.