Home / WordPress / Add custom post type with add category option wordpress

Add custom post type with add category option wordpress

// Our custom post type function
function services() {

register_post_type( 'services',
// CPT Options
array(
'labels' => array(
'name' => __( 'services' ),
'singular_name' => __( 'services' )
),
'public' => true,
'has_archive' => false,
'rewrite' => array('slug' => 'services'),
#'supports' => array( 'title', 'editor', 'thumbnail' ),
'supports' => array( '' ),
)
);
}

// Hooking up our function to theme setup
add_action( 'init', 'services' );

register_taxonomy(
"service_categories",
array("services"),
array("hierarchical" => true,
"label" => "Categories",
"singular_label" => "Category",
"rewrite" =>
array(
'slug' => 'services',
'with_front'=> false )
)
);

Hits: 7

Leave a Reply