-
Notifications
You must be signed in to change notification settings - Fork 9
Docs PostType
Evan Mattson edited this page Jun 20, 2016
·
4 revisions
use Silk\Post\PostType;
The PostType
class models a single post type.
Create a new PostType
instance for an existing post type.
Return PostType
$type = PostType::load('post');
--
Possibly the most common method to start with. If the post type exists it returns a new PostType
instance, otherwise it returns a new PostTypeBuilder
instance for building up a new post type to register.
$type = PostType::make('some-post-type');
--
Check if the post type exists.
PostType::exists('some-type');
Return (bool)
Add post type support for one or more features.
Return PostType
$type->addSupportFor('cookies', 'milk');
// or
$type->addSupportFor(['cookies', 'milk']);
--
Remove post type support for one or more features.
Return PostType
$type->removeSupportFor('lame-stuff', 'bugs');
// or
$type->removeSupportFor(['lame-stuff', 'bugs']);
--
Check for post type support for one or more features.
Return (bool) true
if all listed features are supported, otherwise false
.
$type->supports('good-guys', 'bad-guys');
// or
$type->supports(['good-guys', 'bad-guys']);
--
Unregister the post type.
$type->unregister();