Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- register_post_type( 'connector',
- array(
- 'labels' => array(
- 'name' => __( 'Connectors' ),
- 'singular_name' => __( 'Connector' ),
- 'all_items' => __( 'All Connectors' ),
- 'add_new' => __( 'Add Connector' ),
- 'add_new_item' => __( 'Add New Connector' ),
- 'edit' => __( 'Edit'),
- 'edit_item' => __( 'Edit Connector' ),
- 'new_item' => __( 'New Connector'),
- 'view' => __( 'View Connector'),
- 'view_item' => __( 'View Connector'),
- 'search_items' => __( 'Search Connectors'),
- 'not_found' => __( 'No Connectors found' ),
- 'not_found_in_trash' => __( 'No Connectors found in trash' ),
- 'parent' => __( 'Parent Connector')
- ),
- 'description' => __( 'This is where you can add new Connectors' ),
- 'public' => true,
- 'show_ui' => true,
- 'capability_type' => 'page',
- 'publicly_queryable' => true,
- 'exclude_from_search' => false,
- 'hierarchical' => true,
- 'rewrite' => array( 'slug' => 'connector', 'with_front' => false ),
- 'query_var' => true,
- 'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'excerpt','author',/*, 'page-attributes'*/ ),
- 'taxonomies' => array('post_tag'), // this is IMPORTANT for adding tags
- 'has_archive' => true,
- 'show_in_nav_menus' => true,
- 'show_in_menu'=>false
- )
- );
- function modify_connectors() {
- if ( post_type_exists( 'connector' ) ) {
- $capabilities = array(
- 'publish_posts' => 'publish_connectors',
- 'edit_posts' => 'edit_connectors',
- 'edit_others_posts' => 'edit_others_connectors',
- 'delete_posts' => 'delete_connectors',
- 'delete_others_posts' => 'delete_others_connectors',
- 'read_private_posts' => 'read_private_connectors',
- 'edit_post' => 'edit_connector',
- 'delete_post' => 'delete_connector',
- 'read_post' => 'read_connector',
- );
- global $wp_post_types, $wp_rewrite;
- $wp_post_types['connector']->hierarchical = true;
- $wp_post_types['connector']->capability_type = 'connector';
- $wp_post_types['connector']->capabilities = $capabilities;
- //I am not sure from nowonwards am I doing right or wrong
- $args = $wp_post_types['connector'];
- $wp_rewrite->add_rewrite_tag("%connector%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=connector&name=");
- add_post_type_support('connector','page-attributes');
- }
- }
- add_action( 'init', 'modify_connectors', 1 );
- 'description' => __( 'This is where you can add new Connectors' ),
- 'public' => true,
- 'show_ui' => true,
- 'capability_type' => 'page',
- 'publicly_queryable' => true,
- 'exclude_from_search' => false,
- 'hierarchical' => true,
- 'capabilities' => array(
- 'publish_posts' => 'update_core',
- 'edit_others_posts' => 'update_core',
- 'delete_posts' => 'update_core',
- 'delete_others_posts' => 'update_core',
- 'read_private_posts' => 'update_core',
- 'edit_post' => 'edit_posts',
- 'delete_post' => 'update_core',
- 'read_post' => 'edit_posts',
- ),
- 'rewrite' => array( 'slug' => 'connector', 'with_front' => false ),
- 'query_var' => true,
- 'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'excerpt','author',/*, 'page-attributes'*/ ),
- 'taxonomies' => array('post_tag'), // this is IMPORTANT for adding tags
- 'has_archive' => true,
- 'show_in_nav_menus' => true,
- 'show_in_menu'=>false
- ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement