Custom Post Type, Capabilities and Members plugin
-
Hi all,
i’ve been trying to do something that shoudl be easy, but with no luck. I hope that someone can help me.This is what I’ve in mind
1) create a custom post type with custom capabilities writing code in functionts.php
2) manage capabilities on the fly (give or revoke) of this post type with Members plugin (or others like user role editor… they are quite the same for what I woudl like to do.. don’t?)
This is how I do it
1) Custom Post Type “Eventi” just written in functions.php
(singular and plural are in Italian)function events() { $labels = array( 'name' => 'Eventi', 'singular_name' => 'Evento', 'add_new' => 'Aggiungi Nuovo', 'add_new_item' => 'Aggiungi Nuovo Evento', 'edit_item' => 'Modifica Evento', 'new_item' => 'Nuovo Evento', 'view_item' => 'Vedi Evento', 'search_items' => 'Cerca Evento', 'not_found' => 'Nessun Evento Trovato', 'not_found_in_trash' => 'Nessun Evento trovato nel Cestino', 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'show_ui' => true, 'menu_position' => 4, 'menu_icon' => get_bloginfo('stylesheet_directory').'/images/events-icon.gif', // 16px16 'capability_type' => array('evento', 'eventi'), 'capabilities' => array( 'publish_posts' => 'publish_eventi', 'edit_posts' => 'edit_eventi', 'edit_others_posts' => 'edit_others_eventi', 'delete_posts' => 'delete_eventi', 'delete_others_posts' => 'delete_others_eventi', 'read_private_posts' => 'read_private_eventi', 'edit_post' => 'edit_evento', 'delete_post' => 'delete_evento', 'read_post' => 'read_evento', ), 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => array("slug" => "evento"), '_builtin' => false, 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'author', 'page-attributes' )); register_post_type( 'events' , $args ); $labelcatg = array( 'name' => _x( 'Tipi Evento', 'taxonomy general name' ), 'singular_name' => _x( 'Tipo Evento', 'taxonomy singular name' ), 'search_items' => __( 'Cerca Tipi Evento' ), 'all_items' => __( 'Tutti i Tipi Evento' ), 'parent_item' => __( 'Tipo Evento Padre' ), 'parent_item_colon' => __( 'Tipo Evento Padre:' ), 'edit_item' => __( 'Modifica Tipo Evento' ), 'update_item' => __( 'Aggiorna Tipo Evento' ), 'add_new_item' => __( 'Aggiungi Tipo Evento' ), 'new_item_name' => __( 'Nuovo Tipo Evento' ), ); register_taxonomy('tipievento','events',array( 'hierarchical' => true, 'labels' => $labelcatg, 'show_ui' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'tipoevento' ), )); register_taxonomy_for_object_type('post_tag', 'events'); register_taxonomy_for_object_type('zone', 'events'); } add_action('init', 'events');
Then I install Members Plugin and I go to roles admi page to apply the capabilities i’ve created to some roles.
but, sadly, the custom post type capabilities are not there!
Where am I wrong?
- The topic ‘Custom Post Type, Capabilities and Members plugin’ is closed to new replies.