Advanced
Custom Post Types
Create CPT in WordPress
WordPress documentation about post types
In te first part of this Tutorial by Faust they guide you through the steps to set up your CPT
Check query in GraphiQl IDE
Add the query in your project
Create movies.wql and put it in /extend/queries folder in your project
query Movies($limit: Int = 10) {
movies(first: $limit) {
nodes {
...Movie
}
}
}
fragment Movie on Movie {
...ContentNode
...NodeWithFeaturedImage
content
title
editorBlocks {
name
}
}
Based on the above infomation WPNuxt will generate:
- the type 'MovieFragment'
- the composable 'useMovies':
- input params: { limit: integer }
- return: MovieFragment