Skip to content
Permalink
Browse files

Added Background and Font Color for the Login Screen.

  • Loading branch information...
djm56 committed Feb 16, 2018
1 parent 0c3832c commit 885b9113692b25aa6c1c59d10ba73a549572e82a
@@ -8,8 +8,9 @@ This plugin is used to customize the wp-admin:
2. Adds a custom dashboard item
3. Logo for login page
4. Removes all Dashboard items.
5. Select Color for Login Page Background and Font

Version: 1.1.0
Version: 1.2.0

## How to Install

@@ -10,7 +10,7 @@
* Plugin Name: WordPress Admin Customizer
* Plugin URI: https://github.com/djm56/WordPress-Admin-Customizer
* Description: Some simple changes to Admin, Login Logo, Admin Copyright and other simple changes.
* Version: 1.1.0
* Version: 1.2.0
* Author: Donovan Maidens
* Author URI: https://wpza.co.za
*/
@@ -49,6 +49,8 @@ public static function activate() {
"wac_text_field_2" => "No",
"wac_text_field_3" => "No",
"wac_text_field_4" => "",
"wac_text_field_5" => "",
"wac_text_field_6" => "",
);
update_option('wac_settings', $arr);
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -9,13 +9,34 @@ function login_css() {
wp_enqueue_style('custom-login', plugins_url('/assets/style.css', __FILE__));
$options = get_option('wac_settings');
$optionfield = sanitize_text_field($options['wac_text_field_4']);
$colorfield = sanitize_text_field($options['wac_text_field_5']);
$fontfield = sanitize_text_field($options['wac_text_field_6']);
if (!empty($optionfield)) :
?>
<style>
#login h1 a {
background-image: url("<?php echo $optionfield; ?>") !important;
background-size: 312px;
width: 100%;
}
</style>
<?php
endif;
if (!empty($colorfield)) :
?>
<style>
body.login {
background-color: <?php echo $colorfield; ?> !important;
}
</style>
<?php
endif;
if (!empty($fontfield)) :
?>
<style>
body.login p#nav, body.login p#backtoblog,
body.login p#nav a, body.login p#backtoblog a {
color: <?php echo $fontfield; ?> !important;
}
</style>
<?php
@@ -5,6 +5,16 @@
* @package wordpress-admin-customizer.
*/
function my_plugin_admin_scripts() {
// if ( 'settings_page_myplugin' != $hook ) { //set your plugin page
// return;
// }
wp_enqueue_style('wp-color-picker');
wp_enqueue_script('wp-color-picker-alpha', plugins_url('assets/wp-color-picker-alpha.min.js', __FILE__), array('wp-color-picker'), '1.0.0', true);
}
add_action('admin_enqueue_scripts', 'my_plugin_admin_scripts');
add_action('admin_menu', 'wac_add_admin_menu');
add_action('admin_init', 'wac_settings_init');
@@ -36,6 +46,12 @@ function wac_settings_init() {
add_settings_field(
'wac_text_field_4', __('Logo for Admin Login', 'wordpress-admin-customizer'), 'wac_text_field_4_render', 'pluginPage', 'wac_pluginPage_section'
);
add_settings_field(
'wac_text_field_5', __('Login Background Color', 'wordpress-admin-customizer'), 'wac_text_field_5_render', 'pluginPage', 'wac_pluginPage_section'
);
add_settings_field(
'wac_text_field_6', __('Login Font Color', 'wordpress-admin-customizer'), 'wac_text_field_6_render', 'pluginPage', 'wac_pluginPage_section'
);
add_settings_field(
'wac_text_field_3', __('Restore Defaults Upon Reactivation?', 'wordpress-admin-customizer'), 'wac_text_field_3_render', 'pluginPage', 'wac_pluginPage_section'
);
@@ -81,7 +97,7 @@ function wac_text_field_4_render() {
<img class="header_logo" src="<?php echo sanitize_text_field($options['wac_text_field_4']); ?>" /><br>
<input type='text' class='header_logo_url' name='wac_settings[wac_text_field_4]' value='<?php echo sanitize_text_field($options['wac_text_field_4']); ?>'>
<a href="#" class="header_logo_upload button button-primary">Upload</a>
<p><small>Upload the image that is 312px × 100px.</small></p>
<p><small>Upload the image that is 312px × 84px. Also try make it a Alpha PNG (A Logo with invisible background).</small></p>
<script>
jQuery(document).ready(function ($) {
$('.header_logo_upload').click(function (e) {
@@ -107,6 +123,22 @@ function wac_text_field_4_render() {
<?php
}
function wac_text_field_5_render() {
$options = get_option('wac_settings');
?>
<input type='text' class='color-picker' data-alpha='true' name='wac_settings[wac_text_field_5]' value='<?php echo sanitize_text_field($options['wac_text_field_5']); ?>'>
<p><small>Please select background color for Login screen.</small></p>
<?php
}
function wac_text_field_6_render() {
$options = get_option('wac_settings');
?>
<input type='text' class='color-picker' data-alpha='true' name='wac_settings[wac_text_field_6]' value='<?php echo sanitize_text_field($options['wac_text_field_6']); ?>'>
<p><small>Please select font color for Login screen.</small></p>
<?php
}
function wac_settings_section_callback() {
echo __('Customize this WordPress Install with a custom login logo, and other description\'s and details.', 'wordpress-admin-customizer');
}
@@ -115,13 +147,12 @@ function wac_options_page() {
?>
<form action='options.php' method='post' enctype="multipart/form-data">
<h1>Admin Customizer</h1>
<?php
settings_fields('pluginPage');
do_settings_sections('pluginPage');
submit_button();
?>
<?php
settings_fields('pluginPage');
do_settings_sections('pluginPage');
submit_button();
?>
<p><small>Developed by WPZA Website Maintenance Services. <a href="https://wpza.co.za">https://wpza.co.za</a></small></p>
</form>
<?php
}
<?php
}

0 comments on commit 885b911

Please sign in to comment.
You can’t perform that action at this time.