php - Regisitry post type wordpress -


i registered new post type & named eassy.

i added 2 new users role, 1 member_area , 1 mentor_area. when member_area role users login dashboard have see,edit,delete,publish there own posts .. , don't control on other users posts..

but in case mentor_area users can see member_area users posts,edit,delete, (full control).

is can done wordpress default functions or have use plugins this? can 1 show me example this?..

and want know how show eassy post type link on left sidbar 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 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 can use "user role editor plugin": http://wordpress.org/extend/plugins/user-role-editor/


Comments