tkj / posttype
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-10-26 15:51:46 UTC
README
Easy API to create Wordpress posttypes.
Installation
To install this package you have a couple of options.
Install through composer
require {
"tkj/posttype": "1.*"
}
Manual install through git
Clone the git repository into your prefered destination in your theme directory and require the Posttype.php
in your functions.php
git clone git@github.com:tkjaergaard/Wordpress-Posttype.git
Usage
The API of this package is quite simple. Simply create a new instance of Tkj\Posttype
or use the facade Tkj\Posttype::make()
<?php
use Tkj\Posttype;
new Posttype($singular);
Posttype::make($singular);
Arguments
The options and labels array uses the same structure as Wordpress reqister_post_type() function.
Default options
The default options are pretty basic and shoud fit your needs in most cases.
{
'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']
}
Default labels
The labes are generated from the singular and/or the plural arguments you use to create the post type. The labels are generated in english.
License
This package is released under the MIT license.
Author
Thomas Kjaergaard @t_kjaergaard tkjaergaard.dk