Custom post type means we can create new custom posts in WordPress. By default wordpress have articles of type post But we can extend its functionality to create our own custom post types . all the posts are stored in the same place, in the wp_posts database table, but are differentiated by a column called post_type. 

To create custom post  type we need to modify our theme’s function.php which is in theme folder . Also we can use this in plugin’s file . WordPress have an inbuilt function for this task .

register_post_type( 'blog', $args );

and we can extend this by arguments . Simply like

add_action( 'init', 'codingbin_blogs_init' );
/**
 * Register a blog post type.
 *
 * @link http://codex.wordpress.org/Function_Reference/register_post_type
 */
function codingbin_blogs_init() {
 $labels = array(
 'name' => _x( 'Blogs', 'post type general name', 'your-plugin-textdomain' ),
 'singular_name' => _x( 'Blog', 'post type singular name', 'your-plugin-textdomain' ),
 'menu_name' => _x( 'Blogs', 'admin menu', 'your-plugin-textdomain' ),
 'name_admin_bar' => _x( 'Blog', 'add new on admin bar', 'your-plugin-textdomain' ),
 'add_new' => _x( 'Add New', 'book', 'your-plugin-textdomain' ),
 'add_new_item' => __( 'Add New Blog', 'your-plugin-textdomain' ),
 'new_item' => __( 'New Blog', 'your-plugin-textdomain' ),
 'edit_item' => __( 'Edit Blog', 'your-plugin-textdomain' ),
 'view_item' => __( 'View Blog', 'your-plugin-textdomain' ),
 'all_items' => __( 'All Blog', 'your-plugin-textdomain' ),
 'search_items' => __( 'Search Blog', 'your-plugin-textdomain' ),
 'parent_item_colon' => __( 'Parent Blog:', 'your-plugin-textdomain' ),
 'not_found' => __( 'No Blogs found.', 'your-plugin-textdomain' ),
 'not_found_in_trash' => __( 'No Blogs found in Trash.', 'your-plugin-textdomain' )
 );

 $args = array(
 'labels' => $labels,
 'public' => true,
 'publicly_queryable' => true,
 'show_ui' => true,
 'show_in_menu' => true,
 'query_var' => true,
 'rewrite' => array( 'slug' => 'blog' ),
 'capability_type' => 'post',
 'has_archive' => true,
 'hierarchical' => false,
 'menu_position' => null,
 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ) // 
 );

 register_post_type( 'blog', $args );
}

We can also divide the custom post type with categories same like in the WordPress posts by simply add the following code with custom post type . We are creating categories for post type blog.

add_action( 'init', 'create_blog_taxonomies', 0 );

// create two taxonomies, genres and writers for the post type "book"
function create_blog_taxonomies() {
 // Add new taxonomy, NOT hierarchical (like tags)
 $labels = array(
 'name' => _x( 'Categories', 'taxonomy general name' ),
 'singular_name' => _x( 'Writer', 'Category singular name' ),
 'search_items' => __( 'Search Category' ),
 'popular_items' => __( 'Popular Category' ),
 'all_items' => __( 'All Categories' ),
 'parent_item' => null,
 'parent_item_colon' => null,
 'edit_item' => __( 'Edit Category' ),
 'update_item' => __( 'Update Category' ),
 'add_new_item' => __( 'Add New Category' ),
 'new_item_name' => __( 'New Category Name' ),
 'separate_items_with_commas' => __( 'Separate Category with commas' ),
 'add_or_remove_items' => __( 'Add or remove Category' ),
 'choose_from_most_used' => __( 'Choose from the most used Category' ),
 'not_found' => __( 'No Categories found.' ),
 'menu_name' => __( 'Category' ),
 );

 $args = array(
 'hierarchical' => true,
 'labels' => $labels,
 'show_ui' => true,
 'show_admin_column' => true,
 'update_count_callback' => '_update_post_term_count',
 'query_var' => true,
 'rewrite' => array( 'slug' => 'blogcategories' ),
 );

 register_taxonomy( 'Blogcategories', 'blog', $args );
}

similarly we can add Tags with custom post types . The only difference in the categories and tags is categories are hierarchical where as tags are not . So we can add


// hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_blog_taxonomies_tags', 0 );

// create two taxonomies, genres and writers for the post type "book"
function create_blog_taxonomies_tags() {
 $labels = array(
 'name' => _x( 'Tags', 'taxonomy general name' ),
 'singular_name' => _x( 'Tags', 'taxonomy singular name' ),
 'search_items' => __( 'Search Genres' ),
 'all_items' => __( 'All Tags' ),
 'parent_item' => __( 'Parent Tags' ),
 'parent_item_colon' => __( 'Parent Tags:' ),
 'edit_item' => __( 'Edit Tags' ),
 'update_item' => __( 'Update Tags' ),
 'add_new_item' => __( 'Add New Tags' ),
 'new_item_name' => __( 'New Tags Name' ),
 'menu_name' => __( 'Tags' ),
 );

 $args = array(
 'hierarchical' => false,
 'labels' => $labels,
 'show_ui' => true,
 'show_admin_column' => true,
 'query_var' => true,
 'rewrite' => array( 'slug' => 'BlogTags' ),
 );

 register_taxonomy( 'BlogTags', array( 'blog' ), $args );


}

http://codingbin.com/wp-content/uploads/2015/11/wordpress-custom-post-types-cpt1.pnghttp://codingbin.com/wp-content/uploads/2015/11/wordpress-custom-post-types-cpt1-150x150.pngdevidcmsWordPresscustome post type,wordpressCustom post type means we can create new custom posts in WordPress. By default wordpress have articles of type post But we can extend its functionality to create our own custom post types . all the posts are stored in the same place, in the wp_posts database table, but are differentiated by...coding, php, wordpress, yii, cakephp, and  jquery

Are you want to get implementation help, or modify or extend the functionality of this script? Submit paid service request