Hint
The changes on roles and no layout-topics should not a part of a Theme, is much more a topic for a plugin. maybe you think about this topic on point like maintenance, switch of theme and hooks for activation – easier on plugins.
For your problem
You must add the roles new capabilities for your custom post type and remove the capabilities for type post
. On activation change the roles for the follow capabilities.
foreach ( self::$todo_roles as $role ) {
$wp_roles->add_cap( $role, 'edit_' . self::$post_type_1 );
$wp_roles->add_cap( $role, 'read_' . self::$post_type_1 );
$wp_roles->add_cap( $role, 'delete_' . self::$post_type_1 );
$wp_roles->add_cap( $role, 'edit_' . self::$post_type_1 . 's' );
$wp_roles->add_cap( $role, 'edit_others_' . self::$post_type_1 . 's' );
$wp_roles->add_cap( $role, 'publish_' . self::$post_type_1 . 's' );
$wp_roles->add_cap( $role, 'read_private_' . self::$post_type_1 . 's' );
$wp_roles->add_cap( $role, 'delete_' . self::$post_type_1 . 's' );
$wp_roles->add_cap( $role, 'delete_private_' . self::$post_type_1 . 's' );
$wp_roles->add_cap( $role, 'delete_published_' . self::$post_type_1 . 's' );
$wp_roles->add_cap( $role, 'delete_others_' . self::$post_type_1 . 's' );
$wp_roles->add_cap( $role, 'edit_private_' . self::$post_type_1 . 's' );
$wp_roles->add_cap( $role, 'edit_published_' . self::$post_type_1 . 's' );
}
With something like the above you can add capabilities the roles.
You should also do this to remove all rights for the type post
.
$wp_roles->remove_cap( ... )
As hint to the source. The self::$post_type_1
is a variable in a class for the custom post type. The foreach
loop is to add this capabilities often to different roles.