- Install the dependencies via composer
- Create a mysql database
- Create a
.env
following the structure of the.env.example
- Run the project with
composer run dev
, it will start the project atlocalhost:8080
- Go to http://localhost:8080/wp/wp-admin/themes.php and activate the theme
devbackend
- Go to http://localhost:8080/wp/wp-admin/plugins.php and activate the graphql plugin
- Always work inside of
web/app/theme/devbackend
- Please, do not install any other dependency.
- Create a new Custom Post Type (https://wordpress.org/support/article/post-types/#custom-post-types) called
product
. - Create an
image
field inproduct
: https://docs.carbonfields.net/learn/fields/image.html - Create a relationship where one product can have many posts and one post can be linked to one product. To do that, you should create fields using an Association Field (https://docs.carbonfields.net/learn/fields/association.html):
product->posts
andpost->product
. - Could you make it two-way data binding? It means: when I save a product with two posts, it should update the posts that are related to the product; and if I update a related post, it should update the product as well.
- Create the representation of a
product
in the graphql schema: https://www.wpgraphql.com/docs/custom-post-types/ - In the graphql schema, create the field
product.image
that should be similar topost.featuredImage
schema, usingMediaItem
type. - Create the field
product.posts
and the fieldpost.product
in the graphql schema: https://www.wpgraphql.com/docs/connections/ (documentation) and https://www.wpgraphql.com/recipes/popular-posts/ (example of similar usage) - Document your work in your preferred way.
Find a way to auto activate the theme and the plugins after installing the dependencies.
Fork this repo and send us the link to your clone at GitHub. If your repo is private, give permissions to @matepaiva.