Skip to content

Docs PostType

Evan Mattson edited this page Jun 20, 2016 · 4 revisions
use Silk\Post\PostType;

The PostType class models a single post type.

Static Methods

load

Create a new PostType instance for an existing post type.

Return PostType

$type = PostType::load('post');

--

make

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');

--

exists

Check if the post type exists.

PostType::exists('some-type');

Return (bool)

Instance Methods

addSupportFor

Add post type support for one or more features.

Return PostType

$type->addSupportFor('cookies', 'milk');
// or
$type->addSupportFor(['cookies', 'milk']);

--

removeSupportFor

Remove post type support for one or more features.

Return PostType

$type->removeSupportFor('lame-stuff', 'bugs');
// or
$type->removeSupportFor(['lame-stuff', 'bugs']);

--

supports

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

Unregister the post type.

$type->unregister();
Clone this wiki locally