code link- https://www.dropbox.com/s/76xabzzqqzoeh2c/sample.php?dl=0
*
* create a folder named sample under the plugin directory in wordpress wp-content/plugins/ and put the sample.php to it 100% working
*/
<?php
/*
* Plugin Name:Sample
* Description:Test purpose
* Plugin URI:http://hhiitthhiinn.blogspot.com
* Author:Hithin chandran
* Version:1.0
* AUTHOR URI:http://hhiitthhiinn.blogspot.com
*/
function my_custom_post_product() {
$labels = array(
'name' => _x( 'Samples', 'post type general name' ),
'singular_name' => _x( 'Sample', 'post type singular name' ),
'add_new' => _x( 'Add New', 'Sample' ),
'add_new_item' => __( 'Add New Sample ' ),
'edit_item' => __( 'Edit Sample' ),
'new_item' => __( 'New Sample' ),
'all_items' => __( 'All Samples' ),
'view_item' => __( 'View samples' ),
'search_items' => __( 'Search Samples' ),
'not_found' => __( 'No samples found' ),
'not_found_in_trash' => __( 'No samples found in the Trash' ),
'parent_item_colon' => '',
'menu_name' => 'Samples'
);//label settings
$args = array(
'labels' => $labels,
'description' => 'Holds our Samples and sample specific data',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments','custom-fields','trackbacks',"page-attributes","post-formats" ),
'has_archive' => true,
"slug"=>"sample",
"show_in_admin_bar"=>true,
"menu_icon"=>"dashicons-smiley",
"can_export"=>TRUE
);//custom post type attributes
register_post_type( 'product', $args );//used to register a post type
}
add_action( 'init', 'my_custom_post_product' );//adding the post type
//visit https://codex.wordpress.org/Function_Reference/register_post_type for more information
*
* create a folder named sample under the plugin directory in wordpress wp-content/plugins/ and put the sample.php to it 100% working
*/
<?php
/*
* Plugin Name:Sample
* Description:Test purpose
* Plugin URI:http://hhiitthhiinn.blogspot.com
* Author:Hithin chandran
* Version:1.0
* AUTHOR URI:http://hhiitthhiinn.blogspot.com
*/
function my_custom_post_product() {
$labels = array(
'name' => _x( 'Samples', 'post type general name' ),
'singular_name' => _x( 'Sample', 'post type singular name' ),
'add_new' => _x( 'Add New', 'Sample' ),
'add_new_item' => __( 'Add New Sample ' ),
'edit_item' => __( 'Edit Sample' ),
'new_item' => __( 'New Sample' ),
'all_items' => __( 'All Samples' ),
'view_item' => __( 'View samples' ),
'search_items' => __( 'Search Samples' ),
'not_found' => __( 'No samples found' ),
'not_found_in_trash' => __( 'No samples found in the Trash' ),
'parent_item_colon' => '',
'menu_name' => 'Samples'
);//label settings
$args = array(
'labels' => $labels,
'description' => 'Holds our Samples and sample specific data',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments','custom-fields','trackbacks',"page-attributes","post-formats" ),
'has_archive' => true,
"slug"=>"sample",
"show_in_admin_bar"=>true,
"menu_icon"=>"dashicons-smiley",
"can_export"=>TRUE
);//custom post type attributes
register_post_type( 'product', $args );//used to register a post type
}
add_action( 'init', 'my_custom_post_product' );//adding the post type
//visit https://codex.wordpress.org/Function_Reference/register_post_type for more information