waughj/wp-meta-box
Composer 安装命令:
composer require waughj/wp-meta-box
包简介
Simple class for easily adding meta boxes for WordPress admin editors.
关键字:
README 文档
README
Simple class for easily adding meta boxes for WordPress admin editors.
Use
You just need to create an instance o' this class before the admin loads & the constructor will automatically call all the WordPress functions needed to set a meta box up.
1st 2 mandatory arguments to constructor are the identifying slug & public title shown in editor. The optional 3rd argument is a hash map o' extra arguments.
- "post-type": Array o' post types this should show up in. Default is array with just "page".
- "input-type": String specifying type o' input HTML to form in the editor:
- The default is "text".
- 'Cept for the following exceptions, the any value will create an input tag with the type set to the given type. Thus, "number", "tel", "email", "password", & other HTML input types will work.
- "textarea" will create a textarea tag.
- "select" will create a select tag. Also requires optional argument "values", which should be an array o' hash maps with "id" & "name" key values. When used, the "id" value will be the actual value saved into the database, while the "name" value will show in the select box.
- "day-of-the-week" will automatically create a select without needing the "values" argument. Values will be set to the 7 days o' week, whose IDs will be the #s 0 to 6 for Monday to Sunday.
Example
use WaughJ\WPMetaBox\WPMetaBox;
new WPMetaBox
(
'color',
'Color',
[
'post-type' => 'news-post',
'input-type' => 'select',
'values' =>
[
[ 'id' => '0', 'name' => 'Red' ],
[ 'id' => '1', 'name' => 'Blue' ],
[ 'id' => '2', 'name' => 'Green' ]
]
]
);
Changelog
0.3.0
- Change input IDs to have “-input” appended to them to prevent collision with outer box
- WordPress automatically applies our the meta box slug to the outer box of the input box beyond our control, so we have to change the ID of the inner input box to prevent multiple elements with the same ID, which is invalid HTML
0.2.1
- Update TestHashItem dependency
0.2.0
- Add getValue Method
0.1.4
- Fix Saving
0.1.3
- Fix Missing Use Statement Bug
- Missing "use" statement caused constructor to fail
0.1.2
- Fix Example in Readme
- Example didn't use "use" statement to include full class name with namespace, which in most cases will cause an error in code if used. This adds the "use" statement to the example for better clarification
0.1.1
- Improve Argument Name & Readme
- Change "page-type" argument to "post-type" to make it mo' consistent & predictable with WordPress name for concept
- Also adds detailed instructions to readme
0.1.0
- Initial Version
waughj/wp-meta-box 适用场景与选型建议
waughj/wp-meta-box 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 155 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 11 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「meta」 「meta box」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 waughj/wp-meta-box 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 waughj/wp-meta-box 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 waughj/wp-meta-box 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Symfony 4/5 Bundle for box spout excel library v3
Harvest statistics and meta data from an URL or his source code (seo oriented).
Phalcon PHP Meta tags service
Ajax Box widget for Yii 2 Framework.
A SilverStripe module to optimise the Meta, crawling, indexing, and sharing of your website content (forked from Cyber-Duck/Silverstripe-SEO)
Simple minimal but useful set of utils (properties, strings, datetimes, etc.)
统计信息
- 总下载量: 155
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2018-11-24