vendi-advertising/vendi-cpt-from-yaml
Composer 安装命令:
composer require vendi-advertising/vendi-cpt-from-yaml
包简介
Loads CPTs from a yaml file
README 文档
README
Vendi stores CPT information in YAML files and uses this library for parsing and loading CPTs. Although there is a very slight overhead in doing this, the front-end caching will offset this completely. For sites that don't have a front-end cache, the YAML file could be additionally parsed and stored in a transient.
Location and File Name
The config file is generally stored in a folder off of the theme's root called .config with a name of cpts.yaml. You
may also create an environment variable called CPT_YAML_FILE that points either to the absolute path of the config
file, or a path relative to the theme's directory.
Options
The file format is very simple and is intended for the 99% use case for CPTs. There are no features in the YAML file
that aren't available to the traditional register_post_type WordPress function.
- The root key is the WordPress slug for the CPT
- Because this is the slug, just like any other CPT, you should never change this once you've defined it or else your existing content might get lost.
- The two required child keys are
singularandpluralwhich control the display name for the CPT. - Two optional child keys are
singular_lowercaseandplural_lowercasehowever if they are not present they will be generated automatically. - The last optional child key is
extended_optionswhose values map directly to the core WordPress function register_post_type
Sample
# The slug for our alert CPTs alert: # Singular and plural human-readable versions singular: Alert plural: Alerts # The contents of this key are merged with the required WordPress labels and passed directly # as the second argument to the register_post_type function. Common default values for these # items are set in https://github.com/vendi-advertising/vendi-cpt-from-yaml/blob/f85a3db005da11f88b9e5340ba12202b86584f81/src/CPTBase.php#L160 extended_options: supports: - title - editor public: true has_archive: false menu_icon: dashicons-visibility exclude_from_search: true publicly_queryable: false
vendi-advertising/vendi-cpt-from-yaml 适用场景与选型建议
vendi-advertising/vendi-cpt-from-yaml 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 315 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 03 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 vendi-advertising/vendi-cpt-from-yaml 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vendi-advertising/vendi-cpt-from-yaml 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 315
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-12