tkj / posttype
1.0.1
2014-03-18 14:36 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-14 15:16:29 UTC
README
创建 Wordpress posttypes 的简单 API。
安装
要安装此包,您有几个选择。
通过 composer 安装
require {
"tkj/posttype": "1.*"
}
通过 git 手动安装
将 git 仓库克隆到您的主题目录下的首选位置,并在您的 functions.php
中要求 Posttype.php
git clone git@github.com:tkjaergaard/Wordpress-Posttype.git
用法
此包的 API 非常简单。只需创建一个新的 Tkj\Posttype
实例,或使用外观 Tkj\Posttype::make()
<?php
use Tkj\Posttype;
new Posttype($singular);
Posttype::make($singular);
参数
选项和标签数组使用与 Wordpress register_post_type() 函数相同的结构。
默认选项
默认选项非常基本,通常能满足您的需求。
{
'public': true,
'publicly_queryable': true,
'show_ui': true,
'show_in_menu': true,
'query_var': true,
'capability_type': 'post',
'has_archive': true,
'hierarchical': false,
'menu_position': null,
'supports': ['title', 'editor', 'thumbnail', 'excerpt']
}
默认标签
标签是从您用于创建 posttype 的 单数 和/或 复数 参数生成的。标签以英文生成。
许可证
此包采用 MIT 许可证发布。
作者
Thomas Kjaergaard @t_kjaergaard tkjaergaard.dk