Post Type

The main goal of Cuztom is to register Custom Post Types. This can easily be done.

$book = register_cuztom_post_type( $name, $args );

$name
(string|array) The name/title of the Post Type. When using an array, the first element is the name, the second element is the plural name.

$args
(array) Arguments used for the Post Type. Take a look here to see which arguments are available

Arguments

has_archive
Normally has_archive defaults to false, with Cuztom it defaults to true.

Methods

Post Type support

You can add/remove post type support by using a method, handy when you want to add/remove it conditionally. Here is a list of all features.

// Add support
$book->addPostTypeSupport( $feature );

// Remove support
$book->removePostTypeSupport( $feature );

// Check for support
$book->postTypeSupports( $feature );

Add Meta Box

You can use an object method to easily attach a Meta Box to the new Post Type. See Post (Meta Box) for the complete documentation.

$book->addMetaBox( $id, $data );

Add Taxonomy

Like Meta Boxes, you can also attach (existing) Taxonomies to the Post Type object. See Taxonomy for the complete documentation.

$book->addTaxonomy( $name, $args );

Examples

Arguments

You can pass various arguments to Post Type object. Here is the full list.

$book = register_cuztom_post_type( 'Book', array(
    'has_archive'         => true,
    'supports'            => array( 'title', 'editor', 'thumbnail' ),
    'exclude_from_search' => true
) );