matepaiva/wp-graphql-crb
最新稳定版本:0.0.7
Composer 安装命令:
composer require matepaiva/wp-graphql-crb
包简介
Wordpress wrapper to expose Carbon Fields to WpGraphQL queries
README 文档
README
A Wordpress wrapper to expose Carbon Fields to WpGraphQL queries.
Important
This is just the first version. There is a lot of work to be done. This packages exposes all the fields of the container, if the container type is post_meta, term_meta, user_meta, comment_meta or theme_options.
Note: This is a very experimental version, so it is probably shipped with bugs.
Usage
- First you have to install Carbon Fields and WpGraphQL.
- Then install this package via packagist:
composer require matepaiva/wp-graphql-crb - Wrap every Carbon Field container that you want to expose via GraphQL with the static method
WpGraphQLCrb\Container::register. For example:
<?php use WpGraphQLCrb\Container as WpGraphQLCrbContainer; use Carbon_Fields\Container\Container; use Carbon_Fields\Field\Field; WpGraphQLCrbContainer::register( Container::make('term_meta', __('Custom Data', 'app')) ->where('term_taxonomy', '=', 'category') ->add_fields([ Field::make('image', 'crb_img') ->set_value_type('url') ]) );
- Now the query below will work:
{
categories {
edges {
node {
id
crb_img
}
}
}
}
About Theme Options
Theme options are not part of any structure already known by Wordpress, so it has its own root. Every theme_options fields will be displayed in GraphQL as direct children of crb_ThemeOptions. Be carefull about name collision.
统计信息
- 总下载量: 8.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 24
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-22