Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function custom_post_init() {
- // register post_type wheels
- $labels = array(
- 'name' => __( 'Wheels' ),
- 'singular_name' => __( 'Wheel' ),
- 'add_new' => __( 'Add new wheel' ),
- 'add_new_item' => __( 'Add new wheel' ),
- 'edit_item' => __( 'Edit wheel' ),
- 'new_item' => __( 'New wheel' ),
- 'all_items' => __( 'All wheels' ),
- 'view_item' => __( 'View wheel' ),
- 'search_items' => __( 'Search wheels' ),
- 'not_found' => __( 'No wheels' ),
- 'not_found_in_trash' => __( 'No wheels in trash' ),
- 'menu_name' => __( 'Wheels' )
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'exclude_from_search' => false,
- 'public_queryable' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- // 'query_var' => 'wheels',
- 'rewrite' => array( 'slug' => 'wheels', 'feeds' => true ),
- 'has_archive' => true,
- 'menu_position' => 30,
- 'menu_icon' => get_stylesheet_directory_uri() . '/assets/img/cpt-wheel-icon.jpg',
- // 'capability_type' => 'wheel',
- 'capabilities' => array(
- 'publish_posts' => 'publish_wheels',
- 'edit_posts' => 'edit_wheels',
- 'edit_others_posts' => 'edit_others_wheels',
- 'delete_posts' => 'delete_wheels',
- 'delete_others_posts' => 'delete_others_wheels',
- 'read_private_posts' => 'read_private_wheels',
- 'edit_post' => 'edit_wheel',
- 'delete_post' => 'delete_wheel',
- 'read_post' => 'read_wheel'
- ),
- // 'hierarchical' => false,
- 'supports' => array('title', 'editor', 'author', 'thumbnail', 'custom-fields','comments'),
- 'taxonomies' => array('category','post_tag')
- );
- register_post_type( 'wheels', $args );
- }
- add_action( 'init', 'custom_post_init' );
- function add_taxonomy_to_post_type() {
- register_taxonomy_for_object_type('category', 'wheels');
- register_taxonomy_for_object_type('post_tag', 'wheels');
- }
- add_action('init', 'add_taxonomy_to_post_type');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement