Created
December 4, 2017 07:06
-
-
Save humayunahmed8/66627ea1347141807bf889c3a824a847 to your computer and use it in GitHub Desktop.
Register custom post type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Register services custom post type | |
function service_post_type() { | |
$labels = array( | |
'name' => _x( 'Services', 'post type general name', 'your-plugin-textdomain' ), | |
'singular_name' => _x( 'Service', 'post type singular name', 'your-plugin-textdomain' ), | |
'menu_name' => _x( 'Services', 'admin menu', 'your-plugin-textdomain' ), | |
'name_admin_bar' => _x( 'Service', 'add new on admin bar', 'your-plugin-textdomain' ), | |
'add_new' => _x( 'Add New', 'Service', 'your-plugin-textdomain' ), | |
'add_new_item' => __( 'Add New Service', 'your-plugin-textdomain' ), | |
'new_item' => __( 'New Service', 'your-plugin-textdomain' ), | |
'edit_item' => __( 'Edit Service', 'your-plugin-textdomain' ), | |
'view_item' => __( 'View Service', 'your-plugin-textdomain' ), | |
'all_items' => __( 'All Services', 'your-plugin-textdomain' ), | |
'search_items' => __( 'Search Services', 'your-plugin-textdomain' ), | |
'parent_item_colon' => __( 'Parent Services:', 'your-plugin-textdomain' ), | |
'not_found' => __( 'No Services found.', 'your-plugin-textdomain' ), | |
'not_found_in_trash' => __( 'No Services found in Trash.', 'your-plugin-textdomain' ) | |
); | |
$args = array( | |
'labels' => $labels, | |
'description' => __( 'Description.', 'your-plugin-textdomain' ), | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'Service' ), | |
'capability_type' => 'post', | |
'has_archive' => true, | |
'hierarchical' => false, | |
'menu_position' => null, | |
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ) | |
); | |
register_post_type( 'service', $args ); | |
} | |
add_action( 'init', 'service_post_type' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment