-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclean-ui.php
84 lines (71 loc) · 2.65 KB
/
clean-ui.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* Copyright (c) Vincent Klaiber.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @see https://github.com/wordplate/clean-ui
*/
/*
* Plugin Name: Clean UI
* Description: Take control over the administration dashboard.
* Author: WordPlate
* Author URI: https://github.com/wordplate/wordplate
* Version: 1.0.0
* Plugin URI: https://github.com/wordplate/clean-ui
* GitHub Plugin URI: wordplate/clean-ui
*/
function clean_ui_menu_items(): void
{
remove_menu_page('edit-comments.php'); // Comments
// remove_menu_page('edit.php?post_type=page'); // Pages
remove_menu_page('edit.php'); // Posts
remove_menu_page('index.php'); // Dashboard
// remove_menu_page('upload.php'); // Media
}
add_action('admin_init', 'clean_ui_menu_items');
function clean_ui_toolbar_items($menu): void
{
$menu->remove_node('comments'); // Comments
$menu->remove_node('customize'); // Customize
$menu->remove_node('dashboard'); // Dashboard
$menu->remove_node('edit'); // Edit
$menu->remove_node('menus'); // Menus
$menu->remove_node('new-content'); // New Content
$menu->remove_node('search'); // Search
// $menu->remove_node('site-name'); // Site Name
$menu->remove_node('themes'); // Themes
$menu->remove_node('updates'); // Updates
$menu->remove_node('view-site'); // Visit Site
$menu->remove_node('view'); // View
$menu->remove_node('widgets'); // Widgets
$menu->remove_node('wp-logo'); // WordPress Logo
}
add_action('admin_bar_menu', 'clean_ui_toolbar_items', 999);
function clean_ui_dashboard_widgets(): void
{
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']); // Activity
// unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); // At a Glance
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_site_health']); // Site Health Status
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); // WordPress Events and News
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); // Quick Draft
}
add_action('wp_dashboard_setup', 'clean_ui_dashboard_widgets');
function clean_ui_logo(): void
{
$url = get_theme_file_uri('favicon.svg');
$width = 200;
$styles = [
sprintf('background-image: url(%s);', $url),
sprintf('width: %dpx;', $width),
'background-position: center;',
'background-size: contain;',
];
echo sprintf(
'<style> .login h1 a { %s } </style>',
implode('', $styles)
);
}
add_action('login_head', 'clean_ui_logo');