How to Add Costume Post type In WordPress

WordPress can hold and display many different types of content. A single item of such a content is generally called a post, although post is also a specific post type. Internally, all the post types are stored in the same place, in the wp_posts database table, but are differentiated by a column called post_type.

text_domain you can any thing you want to add.

for Beginners

function custom_post_type(){
$args = array(
'public' => true,
'label ' => 'Jobs'
register_post_type( 'jobs', $args );
);
}
add_action( 'init', 'custom_post_type', 0 );

 

For Advance

function custom_post_type() {
$labels = array(
'name' => _x( 'Jobs', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Jobs', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Jobs', 'text_domain' ),
'name_admin_bar' => __( 'Jobs', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( 'All Items', 'text_domain' ),
'add_new_item' => __( 'Add New Item', 'text_domain' ),
'add_new' => __( 'Add New', 'text_domain' ),
'new_item' => __( 'New Item', 'text_domain' ),
'edit_item' => __( 'Edit Item', 'text_domain' ),
'update_item' => __( 'Update Item', 'text_domain' ),
'view_item' => __( 'View Item', 'text_domain' ),
'search_items' => __( 'Search Item', 'text_domain' ),
'not_found' => __( 'Job Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Job Not found in Trash', 'text_domain' ),
);
$args = array(
'label' => __( 'Jobs', 'text_domain' ),
'description' => __( 'Jobs Description', 'text_domain' ),
'labels' => $labels,
'supports' => array( ),
//'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 20,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
"menu_icon" => "dashicons-businessman",
'capability_type' => 'page',
);
register_post_type( 'jobs', $args );
}add_action( 'init', 'custom_post_type', 0 );

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s