Skip to content

Instantly share code, notes, and snippets.

@bulentsakarya
Created October 21, 2017 00:44
Show Gist options
  • Save bulentsakarya/35ed4d136eddf785490f5b94adb7f6d7 to your computer and use it in GitHub Desktop.
Save bulentsakarya/35ed4d136eddf785490f5b94adb7f6d7 to your computer and use it in GitHub Desktop.
admin panel özelleştirme
<?php
/*
Plugin Name: Admin Menu
Description: Admin paneli ve mneü özelleştirme
Version: 0.1
License: GPL
Author: Bülent Sakarya
Author URI: http://www.nivothemes.com
*/
/**
* Removes some menus by page.
*/
add_action('admin_menu', 'nivo_remove_admin_menu');
function nivo_remove_admin_menu() {
get_currentuserinfo();
global $user_level;
if ( $user_level <= 10 ) {
//remove_menu_page( 'index.php' ); //Dashboard
remove_menu_page( 'profile.php' ); //Profile
remove_menu_page( 'jetpack' ); //Jetpack*
//remove_menu_page( 'edit.php' ); //Posts
//remove_menu_page( 'upload.php' ); //Media
remove_menu_page( 'edit.php?post_type=page' ); //Pages
remove_menu_page( 'edit-comments.php' ); //Comments
remove_menu_page( 'themes.php' ); //Appearance
remove_menu_page( 'plugins.php' ); //Plugins
remove_menu_page( 'users.php' ); //Users
remove_menu_page( 'tools.php' ); //Tools
remove_menu_page( 'options-general.php' ); //Settings
//sub menus
//remove_submenu_page( 'themes.php', 'theme-editor.php' );
// remove_meta_box('dashboard_right_now', 'dashboard', 'core');
remove_meta_box('dashboard_activity', 'dashboard', 'core');
remove_meta_box('dashboard_recent_comments', 'dashboard', 'core');
remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');
remove_meta_box('dashboard_plugins', 'dashboard', 'core');
remove_meta_box('dashboard_quick_press', 'dashboard', 'core');
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core');
remove_meta_box('dashboard_primary', 'dashboard', 'core');
remove_meta_box('dashboard_secondary', 'dashboard', 'core');
}
}
/**
* Register a custom menu page.
*/
function nivo_custom_admin_menu() {
add_menu_page(
__('Hakkımızda', 'iprturkey'), // Başlık
__('Hakkımızda', 'iprturkey'), //Menü Linki
'manage_options',
'post.php?post=2&action=edit', //Url
'', //İçeriği Gösterecek Fonksiyon
'dashicons-editor-spellcheck', //İkon
5 //Sıra No
);
}
add_action( 'admin_menu', 'nivo_custom_admin_menu' );
/**
* Get rid of tags on posts.
*/
function nivo_unregister_tags() {
unregister_taxonomy_for_object_type( 'post_tag', 'post' );
unregister_taxonomy_for_object_type( 'category', 'post' );
}
add_action( 'init', 'nivo_unregister_tags' );
/**
* Disable create new page.
*/
function nivo_disable_create_newpage() {
global $wp_post_types;
$wp_post_types['page']->cap->create_posts = 'do_not_allow';
}
add_action('init','nivo_disable_create_newpage');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment