A simple web app to integrate Wordpress as Headless CMS with GraphQL and Reactjs.
/wp-content/themes/APPLIED_THEME_NAME/functions.php
to make a new custom post type supports graphql query add_action('init', function() {
register_post_type('toaster', [
'public' => true,
'label' => 'Toasters',
'show_in_graphql' => true,
'graphql_single_name' => 'Toasters',
'graphql_plural_name' => 'Toasters'
]);
});
/wp-content/plugins
toasterMeta
, then:Toasters
post type.Show in GraphQL
to Yes
value.GraphQL Field Name
to toasterMeta
.Price
and Weight
of field type Number
.cd frontend
to enter frontend folder.npm install && npm run start
to run the client-side.