I registered a new post type & named it as eassy
.
I also added two new users role, one is member_area and another one mentor_area. Now when member_area role users login to dashboard they have to see,edit,delete,publish only there own posts .. and they don't get control over other users posts..
but in case mentor_area users can see all member_area users posts,edit,delete, (full Control).
Is this can be done with WordPress default functions or do i have to use plugins for this? can any one show me a example for this?..
And i also want to know how to show only eassy post type link on left sidbar for member_area & mentor_area dashboard..
add_role ( 'member_area', 'Member Area', array (
'read' => true
) );
add_role ( 'mentor_area', 'Mentor Area', array (
'read' => true
) );
add_action ( 'init', 'create_my_post_types' );
function create_my_post_types() {
$capabilities = array (
'publish_posts' => 'publish_eassy',
'edit_posts' => 'edit_eassy',
'edit_others_posts' => 'edit_others_eassy',
'delete_posts' => 'delete_eassy',
'delete_others_posts' => 'delete_others_eassy',
'read_private_posts' => 'read_private_eassy',
'edit_post' => 'edit_eassy',
'delete_post' => 'delete_eassy',
'read_post' => 'read_eassy'
);
register_post_type ( 'eassymamagment', array (
'labels' => array (
'name' => __ ( 'Eassy' ),
'singular_name' => __ ( 'eassymamagment' )
),
'public' => true,
'capability_type' => 'eassymamagment',
'menu_position' => 6,
'capabilities' => $capabilities,
'rewrite' => array (
'slug' => 'eassymamagment'
)
) );
}
You can create new custom post-type of Eassy:
/*Registery of new post-type:Eassy */
add_action('init', 'create_eassy_taxonomies');
function create_eassy_taxonomies() {
register_taxonomy('eassy','eassy',
array('hierarchical' => true,
'label' => 'Eassy Category') );
}
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'eassy',
array(
'labels' => array(
'name' => _x( 'Eassy', 'taxonomy general name' ),
'singular_name' => _x( 'Eassy', 'taxonomy singular name' ),
'search_items' => __( 'Search Eassy' ),
'all_items' => __( 'All Eassy' ),
'edit_item' => __( 'Edit Eassy' ),
'update_item' => __( 'Update Eassy' ),
'add_new_item' => __( 'Add New Eassy' ),
'new_item_name' => __( 'New Eassy' ),
'menu_name' => __( 'Eassy' ),
),
'public' => true,
'has_archive' => true,
'hierarchical' => true,
'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes' )
)
);
}
To display this post type :
$args = array( 'post_type' => 'eassy', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
the_title();
echo '<div class="entry-content">';
the_content();
echo '</div>';
endwhile;
For user role capabilities editor you can use "USer role editor plugin": http://wordpress.org/extend/plugins/user-role-editor/