Hi, The video tutorial is just awesome, one question I have. Can you please help me - function.php where need to put, I mean which folder of Gatsby js? May I just put it in the main directory of src? Please reply sir I really need the answer.
The file name is called 'functions.php', i.e. 'functions' is plural. It doesn't go in Gatsby. It is located in your activated theme folder in WordPress: wp-content\themes\[name-of-theme-you-are-using]. Be careful: you shouldn't overwrite the existing content of functions.php. Rather, you should put the add_action('graphql_register_types', function () { [... rest of code...]} }); at the bottom of the existing functions.php file. BEWARE: if your theme is not a custom theme created by you, updating the theme will cause the code to be lost. Check out how to create a child theme on the Wordpress Codex: developer.wordpress.org/themes/advanced-topics/child-themes/. Once you've created your child theme you can store the specific code there:
@@najmantube hello bro, i cant understand that. we are using gatsby, so, what is the theme that i should use in wordpress?? this dont have sense for me
If anyone facing issue when running gatsby build. You should use fetch. Steps using same example: 1) In your ApolloClient file import fetch from isomorphic-fetch import fetch from 'isomorphic-fetch' 2) Pass fetch to client export const client = new ApolloClient({ uri: 'site.com/graphql' , fetch }); Also don't forget to run the code in gatsby-ssr.js. This will do the job export {wrapRootElement} from './gatsby-browser';
super video! thank you! but I get an error and the data from the "massege" field is written to all other fields. the error looks like this - ""type": "DUPLICATE_TYPE", "message": "You cannot register duplicate Types to the Schema. The Type 'Template_New' already exists in the Schema. Make sure to give new Types a unique name.", "type_name": "Template_New"," something with plugins, has already reinstalled them. help me please!!
I couldn't install 'react-apollo'. Error message says my version of React is too high. And it looks like 'react-apollo' hasn't been touched for a couple of years. Anyone else run into this problem? Any ideas for a solution (apart from installing a lower version of React into Gatsby which cannot be a good idea!)?
Great video, thanks for the easy explanation. I am building a form but I am getting a status of 400. I checked the fields and everything seems to be fine. If I try to create the mutation query in my local graphiql I get this error message: "Schema is not configured for mutations." Do you have any idea why is this happening? am I missing a configuration?
Really appreciate your contribution. Really help me to get the real idea about Gatsby mutation.
Thanks
Same thing here, I've been struggling with forms and gatsby for days until I decided to see your video, awesome work, appreciate your help!
This is a really interesting workaround.
Hi, The video tutorial is just awesome, one question I have. Can you please help me - function.php where need to put, I mean which folder of Gatsby js? May I just put it in the main directory of src? Please reply sir I really need the answer.
The file name is called 'functions.php', i.e. 'functions' is plural. It doesn't go in Gatsby. It is located in your activated theme folder in WordPress: wp-content\themes\[name-of-theme-you-are-using]. Be careful: you shouldn't overwrite the existing content of functions.php. Rather, you should put the add_action('graphql_register_types', function () { [... rest of code...]} }); at the bottom of the existing functions.php file. BEWARE: if your theme is not a custom theme created by you, updating the theme will cause the code to be lost. Check out how to create a child theme on the Wordpress Codex: developer.wordpress.org/themes/advanced-topics/child-themes/. Once you've created your child theme you can store the specific code there:
@@najmantube hello bro, i cant understand that. we are using gatsby, so, what is the theme that i should use in wordpress?? this dont have sense for me
Thanks for this! Learned a lot.. Can you make a video regarding user registration and log in using Gatsby and WordPress?
Great Tutorial. Can we implement this with Form wizard?
yeah boi!!! thank you so much for this video!
If anyone facing issue when running gatsby build.
You should use fetch.
Steps using same example:
1) In your ApolloClient file import fetch from isomorphic-fetch
import fetch from 'isomorphic-fetch'
2) Pass fetch to client
export const client = new ApolloClient({
uri: 'site.com/graphql' ,
fetch
});
Also don't forget to run the code in gatsby-ssr.js. This will do the job
export {wrapRootElement} from './gatsby-browser';
Great tutorial! What would be the best approach to include the repeater fields? Thank you!
You would use update_sub_field instead of update_field. It has a small example here: www.advancedcustomfields.com/resources/update_sub_field/
@@WPCasts Tried that but it didn't updated the field in the back-end, maybe something that I missed... but thank you
Make sure that is in the "have_rows" loop. If that doesn't work, it might be a problem somewhere else.
Great video. Gonna try this soon
super video! thank you! but I get an error and the data from the "massege" field is written to all other fields. the error looks like this -
""type": "DUPLICATE_TYPE",
"message": "You cannot register duplicate Types to the Schema. The Type 'Template_New' already exists in the Schema. Make sure to give new Types a unique name.",
"type_name": "Template_New","
something with plugins, has already reinstalled them. help me please!!
Great tutorial! Thank you! There is a way to get notifications through email when a new form is submitted? Will be great! 😁
You would need to add wp_mail function after the wp_insert_post if successful
Error in web server but in my local host working properly. Data not submitting web server
I couldn't install 'react-apollo'. Error message says my version of React is too high. And it looks like 'react-apollo' hasn't been touched for a couple of years. Anyone else run into this problem? Any ideas for a solution (apart from installing a lower version of React into Gatsby which cannot be a good idea!)?
Great video!
But should use `gatsby-plugin-apollo`, otherwise it will be wrong in 'gatsby build'
Thanks for this Jerry!
@@WPCasts Thank you very much for this video, I am using it for development, I will always support you.
You can use apollo, but you need to install isomorphic-fetch and use it in client.js
Great video! Very helpful. Do you can share the code please? Thank you so much! 😁
Working on a blog post that will have all the snippets. :)
@@WPCasts Please! It's really a pain to go through the code to see if you made a spelling mistake
But mutation is not working with wordpress basic auth... otherwise working fine
How did you setup your dev environment ?
Great video, thanks for the easy explanation. I am building a form but I am getting a status of 400. I checked the fields and everything seems to be fine. If I try to create the mutation query in my local graphiql I get this error message: "Schema is not configured for mutations." Do you have any idea why is this happening? am I missing a configuration?
Nevermind. After a break, I realized I was using Gatsby's graphiql uri instead of my WP's installation. It's been a long week 😅
hello bro, i get the same issue. How do you solve that?
very helpfull :)
How can I use wp_update_post?
i dont understand where function.php should be ? wp-includes/function.php ?
it goes like this wp-content/themes/{active-theme}/functions.php, here active-theme is your current theme.
recaptcha?
how can i send the data to an email?
WordPress has a PHP mail function called `wp_mail()`. Here is a link to the docs: developer.wordpress.org/reference/functions/wp_mail/
help please throw me the following error,
{
"errors": [
{
"message": "Internal server error",
"category": "internal",
"locations": [
{
"line": 3,
"column": 3
}
],
"path": [
"createSubmission"
]
}
],
"data": {
"__typename": "RootMutation",
"createSubmission": null
}
}