mehedimi/wp-query-builder-ext
最新稳定版本:0.3
Composer 安装命令:
composer require mehedimi/wp-query-builder-ext
包简介
An Extension of WP Query Builder
README 文档
README
WP Query Builder Extension
This is an extension of WP Query Builder.
Installation
It is a composer package. You can install it using composer by executing following composer command.
composer require mehedimi/wp-query-builder-ext
It has some relations and plugins of WP Query Builder.
Relations
WithTaxonomy
With this relation you will be able to load associative taxonomies of specific posts.
// Retrieve all posts with associative taxonomies. DB::table('posts') ->withRelation(new WithTaxonomy('taxonomies')) ->get()
If you need group by taxonomy type then just call groupByTaxonomy method on WithTaxonomy relation.
// Retrieve all posts with associative taxonomies group by with its type. DB::table('posts') ->withRelation(new WithTaxonomy('taxonomies'), function(WithTaxonomy $taxonomy){ $taxonomy->groupByTaxonomy() }) ->get();
Optionally you add constrain of taxonomy type by calling taxonomy method of WithTaxonomy relation.
// This will fetch only category type of taxonomy. DB::table('posts') ->withRelation(new WithTaxonomy('categories'), function(WithTaxonomy $taxonomy){ $taxonomy->taxonomy('category'); })->get();
Plugins
JoinPostWithMeta
With this plugin, you will be able to join postmeta table with posts very easily.
You need to just apply that plugin and that's it.
Some examples are given below:
DB::plugin(new JoinPostWithMeta())->select('posts.*')->where('meta_key', 'some meta key name')->get()
You could supply the join type on JoinPostWithMeta class constructor as well.
// For joining right join `postmeta` with `posts` table DB::plugin(new JoinPostWithMeta('right'))->select('posts.*')->where('meta_key', 'some meta key name')->get()
统计信息
- 总下载量: 45
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-31