Monday, 17 August 2015

how to create custom post type in wordpress with or without categories

/******slider in dashboard***********/

function my_custom_sliders_posttype(){

$args = array(

'labels'=> array( 'name'=>'sliders',

'singular_name'=> 'slider',


'name_admin_bar'=> 'sliders',

'all_items' =>'View all sliders',

'add_new'=> 'Add New sliders' ),

'description' =>"This post type is for sliders",

'public' => true,


'publicly_queryable'=> true,

'show_ui' => true,

'show_in_menu'=> true,

'show_in_admin_bar'=> true,


'capability_type'=> 'page',

'supports'=> array( 'title', 'editor', 'author', 'thumbnail', 'excerpt',




register_post_type( "sliders", $args );




IF NEED sub-categories add this code after

/**********categories in custom post type  ***********/
register_post_type('blog', $portfolio_args);
$categories_labels = array(

    'label' => 'blog Category',

    'hierarchical' => true,

    'query_var' => true
/*********./categories in custom post type  ***********/

No comments:

Post a Comment

Alternative content