Composables

Custom Queries

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

Copyright © 2024 WPNuxt