-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp-admin-customizer.php
125 lines (103 loc) · 3.98 KB
/
wp-admin-customizer.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
/**
* Plugin Name: WP Admin Customizer
* Plugin URI: http://www.wwgate.net
* Description: This plugin give you some options to customize WordPress Admin Panel to make it your own.
* Version: 1.0.0
* Author: Fadi Yousef
* Author http://www.wwgate.net
* License: GPL2
*/
if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' ) ) {
require_once( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' );
}
if ( !isset( $redux_demo ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/barebones-config.php' ) ) {
require_once( dirname( __FILE__ ) . '/ReduxFramework/barebones-config.php' );
}
//change login page logo
function wp_admin_customizer_login_page_style() {
global $wp_admin_customizer_options;
$style = '<style type="text/css">';
if($wp_admin_customizer_options['login-page-logo']['url']){
$style .= 'h1 a {
background-image: url('.$wp_admin_customizer_options['login-page-logo']['url'].') !important;
height: '.$wp_admin_customizer_options['login-page-logo']['height'].'px !important;
width: '.$wp_admin_customizer_options['login-page-logo']['width'].'px !important;
background-size: '. $wp_admin_customizer_options['login-page-logo']['width'] .'px !important;
max-width:320px !important;
}';
}
$style .= 'body.login{
background-color:'.$wp_admin_customizer_options['login-page-background-color'].' !important;
}
.login #backtoblog a, .login #nav a{
color:'.$wp_admin_customizer_options['login-page-links-color'].' !important;
}
.login #backtoblog a:hover, .login #nav a:hover{
color:'.$wp_admin_customizer_options['login-page-links-hover-color'].' !important;
}
.login form{
background-color:'.$wp_admin_customizer_options['login-page-form-background-color'].' !important;
}
.login form label{
color:'.$wp_admin_customizer_options['login-page-form-label-color'].' !important;
}
</style>';
echo $style;
}
add_action('login_head', 'wp_admin_customizer_login_page_style');
//remove wordpress logo from admin bar
function wp_admin_customizer_remove_admin_bar_logo() {
global $wp_admin_bar;
global $wp_admin_customizer_options;
//Remove the WordPress logo...
if($wp_admin_customizer_options['admin-bar-remove-wp-logo']){
$wp_admin_bar->remove_menu('wp-logo');
}
//remove comment from admin bar
if($wp_admin_customizer_options['admin-bar-remove-comment-icon']){
$wp_admin_bar->remove_menu('comments');
}
}
add_action( 'wp_before_admin_bar_render', 'wp_admin_customizer_remove_admin_bar_logo' );
//change howdy text in admin bar
add_action( 'admin_bar_menu', 'wp_admin_bar_my_custom_account_menu', 11 );
function wp_admin_bar_my_custom_account_menu( $wp_admin_bar ) {
global $wp_admin_customizer_options;
$user_id = get_current_user_id();
$current_user = wp_get_current_user();
$profile_url = get_edit_profile_url( $user_id );
if ( 0 != $user_id ) {
/* Add the "My Account" menu */
$avatar = get_avatar( $user_id, 28 );
$howdy = sprintf( __($wp_admin_customizer_options['admin-bar-howdy-text'].' %1$s'), $current_user->display_name );
$class = empty( $avatar ) ? '' : 'with-avatar';
$wp_admin_bar->add_menu( array(
'id' => 'my-account',
'parent' => 'top-secondary',
'title' => $howdy . $avatar,
'href' => $profile_url,
'meta' => array(
'class' => $class,
),
) );
}
}
//remove wordpress version from the footer
function wp_admin_customizer_remove_wp_version() {
global $wp_admin_customizer_options;
if($wp_admin_customizer_options['admin-footer-remove-wp-version']){
remove_filter( 'update_footer', 'core_update_footer' );
}
}
add_action( 'admin_menu', 'wp_admin_customizer_remove_wp_version' );
// remove thank you for creating with wordpress from footer
function wp_admin_customizer_remove_footer_text($text){
global $wp_admin_customizer_options;
if($wp_admin_customizer_options['admin-footer-remove-thankyou-text']){
return false;
}else{
return $text;
}
}
add_filter( 'admin_footer_text', 'wp_admin_customizer_remove_footer_text',100 );