creating custom post type in wordpress' code example
Example 1: wordpress create new post type
register_post_type( 'video',
array(
'labels' => array(
'name' => 'Videos',
'singular_name' => 'Video'
),
'public' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => 'videos'
),
'exclude_from_search'=> true
,
'supports' => array(
'title','editor','thumbnail'
)
)
);
Example 2: create custom post type with category in wordpress functions.php
function create_posttype() {
register_post_type( 'wpll_product',
array(
'labels' => array(
'name' => __( 'Products' ),
'singular_name' => __( 'Product' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'products'),
)
);
}
add_action( 'init', 'create_posttype' );