Musisz stworzyć nowe capabilities i przypisać je dla redaktora.
function add_theme_caps() {
// gets the author role
$role = get_role( 'author' );
// This only works, because it accesses the class instance.
// would allow the author to edit others' posts for current theme only
$role->add_cap( 'edit_my_posts' );
}
add_action( 'admin_init', 'add_theme_caps');
add_submenu_page( 'video', 'Video', 'Ustawienia','edit_my_posts', 'video-setting', 'video_options' );
Zrobiłem jak powiedziałeś ale mam błąd :
Call to undefined function add_submenu_page()
🙂 F1 ? 🙂
// rejestrujemy style w panelu admina
function video_theme() {
wp_enqueue_style('video-theme', plugins_url('../css/style.css', __FILE__));
}
add_action('admin_enqueue_scripts', 'video_theme');
add_action('login_enqueue_scripts', 'video_theme');
// menu wtyczki
function video_menu() {
add_menu_page( 'Video','Video', 'administrator', 'video', 'video_page', plugins_url( 'video/img/youtube.png' ),7);
add_submenu_page( 'video', 'Video', '+ / - film', 'administrator', 'video', 'video_page' );
add_submenu_page( 'video', 'Video', 'Ustawienia','administrator', 'video-setting', 'video_options' );
}
add_action( 'admin_menu', 'video_menu');
function video_page() {
if ( !current_user_can( 'manage_options' ) ) {
wp_die(__( 'oj.. chyba oszukujemy co ?' ) );
}
include 'template.php';
}
//strona ustawien video
function video_options () {
if ( !current_user_can('manage_options')) {
wp_die(__('Oj.. chyba oszukujemy co ?'));
}
include 'video-setting.php';
}
//strona ustawien video
function video_options_u () {
if ( current_user_can('manage_options')) {
wp_die(__('Oj.. chyba oszukujemy co ?'));
}
include 'video-setting.php';
}
Co źle ? 🙂