-
Notifications
You must be signed in to change notification settings - Fork 0
/
asteriski-admin-theme.php
executable file
·79 lines (66 loc) · 2.1 KB
/
asteriski-admin-theme.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
<?php
/**
* Plugin Name: WP Asteriski admin theme
* Plugin URI: https://asteriski.fi
* Description: Hallintapaneelin ulkoasua hieman Asteriskimmaksi
* Version: 1.1
* Author: Maks Turtiainen, Asteriski ry
* Author URI: https://github.com/asteriskiry
* License: GPLv2
**/
/*
Original CSS/SCSS-files published with GPLv2 by Kelly Dwan, Mel Choyce, Dave Whitley, Kate Whitley
Changes by Maks Turtiainen
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/* Korvataan kulmassa oleva Wordpressin logo Asteriskin logolla */
function asteriski_custom_logo() {
echo '
<style type="text/css">
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
background: url(' . plugins_url( 'img/admin-logo-asteriski.svg', __FILE__ ) . ') no-repeat scroll 0 0 / 100% auto !important;
color: transparent;
}
#wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {
background-position: 0 0;
}
</style>
';
}
add_action('wp_before_admin_bar_render', 'asteriski_custom_logo');
/* Väriteeman lataus */
$colors = array(
'asteriski',
);
function add_colors() {
wp_admin_css_color(
'asteriski', __( 'Asteriski', 'admin_schemes' ),
plugins_url( "asteriski/colors.css", __FILE__ ),
array( '#17411e', '#c19a12', '#d66621', '#348d42' ),
array( 'base' => '#17411e', 'focus' => '#c19a12', 'current' => '#d66621' )
);
}
add_action( 'admin_init', 'add_colors' );
/* Asettaa Asteriskin admin teeman oletusteemaksi */
function set_default_admin_color($user_id) {
$args = array(
'ID' => $user_id,
'admin_color' => 'asteriski'
);
wp_update_user( $args );
}
add_action('user_register', 'set_default_admin_color');
/* Login-sivun logo */
function asteriski_custom_login_logo() {
echo '
<style type=text/css>
body.login div#login h1 a {
background-image: url(' . plugins_url( 'img/login-asteriski.png', __FILE__ ) . ');
padding-bottom: 20px;
}
</style>
';
}
add_action( 'login_enqueue_scripts', 'asteriski_custom_login_logo' );