powerbuoy/sleek-post-types
Composer 安装命令:
composer require powerbuoy/sleek-post-types
包简介
Create post types by creating classes in /post-types/.
README 文档
README
BREAKING! v7 - exclude_from_search no longer set to false by default - sleek/post_types/archive_fields filter now gets passed the post type object - not just its name - as its second argument
Create post types by creating classes in /post-types/.
Theme Support
N/A
Hooks
sleek/post_types/field_group
Filter the ACF field group for post types before they're added.
sleek/post_types/fields
Filter the ACF fields for post types before they're added.
sleek/post_types/archive_fields
Filter the ACF fields for the archive settings before they're added.
Functions
Sleek\PostTypes\get_file_meta()
Return information about all files in /post-types/ (internal use).
Classes
Sleek\PostTypes\PostType
Extend this class to create a post type.
PostType::init()
This method is called once on every page load. It allows you to add hooks or do whatever you like related to your post type.
PostType::config()
Return an array of post type configuration here. The array is passed directly to register_post_type. A few additional properties are available:
taxonomies
This is a native WordPress property but unlike when calling register_post_type() any taxonomy set in here will be automatically created if it doesn't already exist.
has_single
Set this to false to disable single pages for the post type.
hide_from_search
Hides the post type from search without the side effects of the built-in exclude_from_search.
has_settings
Set this to false to not add a "Settings" page for the post type.
has_archive
If this is false the settings page will be empty, if not it will have a "Title", "Image" and "Description".
PostType::fields()
Return an array of ACF fields from here and they will be added to the post type.
PostType::sticky_modules()
Return an array of module names and they will be added to the post type. Render a sticky module using Sleek\Modules\render('name-of-module').
PostType::flexible_modules()
Return an array of module names and they will be available in a flexible content field named flexible_modules. An associative array can be used to create multiple flexible content fields;
[
'left_column' => ['text-block', 'text-blocks'],
'right_column' => ['related-posts', 'recent-comments']
]
Render a flexible module field using Sleek\Modules\render_flexible('flexible_modules') or Sleek\Modules\render_flexible('left_column') etc.
PostType::sticky_archive_modules()
Return an array of module names and they will be added to the post type's settings page. Render a sticky module using Sleek\Modules\render('name-of-module', 'mycpt_settings').
PostType::flexible_archive_modules()
Return an array of module names and they will be available in a flexible content field named flexible_modules on the post type's settings page. An associative array can be used here too.
Render modules on the settings page using Sleek\Modules\render_flexible('flexible_modules', 'mycpt_settings').
powerbuoy/sleek-post-types 适用场景与选型建议
powerbuoy/sleek-post-types 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.7k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 09 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 powerbuoy/sleek-post-types 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 powerbuoy/sleek-post-types 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.7k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2019-09-26