Posted By

coryschadt on 04/05/11


Tagged


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

rasitozcan
vrob
hkamci


Wordpress - Custom post types


 / Published in: PHP
 

  1. //-----------register custom post type
  2. register_post_type( 'projects',
  3. 'labels' => array(
  4. 'name' => __( 'Projects' ),
  5. 'singular_name' => __( 'Project' ),
  6. 'add_new' => _x('Add New', 'Project'),
  7. 'add_new_item' => __('Add New Project'),
  8. 'edit_item' => __('Edit Project'),
  9. 'new_item' => __('New Project'),
  10. 'view_item' => __('View Projects'),
  11. ),
  12. 'public' => true,
  13. 'show_ui' => true,
  14. 'menu_icon' => get_stylesheet_directory_uri() . '/assets/images/icon-project.png',
  15. 'hierarchical' => false, //it means we cannot have parent and sub pages
  16. 'capability_type' => 'post', //will act like a normal post
  17. 'rewrite' => 'projects', //this is used for rewriting the permalinks
  18. 'query_var' => false,
  19. 'supports' => array( 'title','editor','thumbnail') //the editing regions that will support
  20. )
  21. );
  22.  
  23. //fixes permalinks issue with custom post types
  24. flush_rewrite_rules();

Report this snippet  

You need to login to post a comment.