webxid/wp-post-wrapper
Composer 安装命令:
composer require webxid/wp-post-wrapper
包简介
The lib help to wrap WP instances and to cache already collected data
README 文档
README
The lib help to wrap WP instances and to cache already collected data. Also, you can implement your own method for a post instance
Install
Run composer require webxid/wp-post-wrapper
How to use
E.g. we have the next implementation: PageBlocks of a posts type and the next SimpleBlock of a post and the next Category of a post taxonomy
Factory method
You can implement a separate class for a specific post and handle custom fields as the post instance properties
Get data
To get a posts list
use WebXID\WpPostWrapper\Example\PageBlocks use WebXID\WpPostWrapper\Example\SimpleBlock; foreach(PageBlocks::buildPostsList() $key => $post) { /** @var SimpleBlock $post */ // do some code }
To build a single post instance
use WebXID\WpPostWrapper\Example\PageBlocks use WebXID\WpPostWrapper\Example\SimpleBlock; /** @var SimpleBlock $post */ $post = PageBlocks::itemFactory(get_post());
To build a taxonomy instance
use WebXID\WpPostWrapper\Example\Category use WebXID\WpPostWrapper\Example\SimpleBlock; /** @var Category $post */ $category = Category::factory(get_queried_object());
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-16