sushma_proach

create new custom post type

May 23rd, 2016
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.41 KB | None | 0 0
  1. <?php
  2.  
  3. add_action( 'init', 'custom_post_type_func' );
  4. function custom_post_type_func() {
  5.     //posttypename = services
  6. $labels = array(
  7. 'name' => _x( 'Services', 'services' ),
  8. 'singular_name' => _x( 'services', 'services' ),
  9. 'add_new' => _x( 'Add New', 'services' ),
  10. 'add_new_item' => _x( 'Add New services', 'services' ),
  11. 'edit_item' => _x( 'Edit services', 'services' ),
  12. 'new_item' => _x( 'New services', 'services' ),
  13. 'view_item' => _x( 'View services', 'services' ),
  14. 'search_items' => _x( 'Search services', 'services' ),
  15. 'not_found' => _x( 'No services found', 'services' ),
  16. 'not_found_in_trash' => _x( 'No services found in Trash', 'services' ),
  17. 'parent_item_colon' => _x( 'Parent services:', 'services' ),
  18. 'menu_name' => _x( 'Services', 'services' ),
  19. );
  20. $args = array(
  21. 'labels' => $labels,
  22. 'hierarchical' => true,
  23. 'description' => 'Hi, this is my custom post type.',
  24. 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ),
  25. 'taxonomies' => array( 'category', 'post_tag', 'page-category' ),
  26. 'public' => true,
  27. 'show_ui' => true,
  28. 'show_in_menu' => true,
  29. 'show_in_nav_menus' => true,
  30. 'publicly_queryable' => true,
  31. 'exclude_from_search' => false,
  32. 'has_archive' => true,
  33. 'query_var' => true,
  34. 'can_export' => true,
  35. 'rewrite' => true,
  36. 'capability_type' => 'post'
  37. );
  38. register_post_type( 'services', $args );
  39. }
  40. ?>
Add Comment
Please, Sign In to add comment