Extending the functionality of White Label Add-on

Put this together to compliment the White Label add-on. Let’s you change the background color, accent color, and change the field opacity. For this client, we use the White Label to put a PNG image as background and their brand mark. This simple plugin then adds the color beneath it. It also changes the logo link from wordpress to the client’s site (you’ll need to change that in the code). Shows up in the settings panel. Maybe something similar can be added to the White Label add on in the future?

    <?php
/*
Plugin Name: Custom Login Background & Styling
Plugin URI: http://franklin.marketing
Description: A plugin to customize the login background color via settings.
Version: 1.0
Author: T.J. Miller
Author URI: http://franklin.marketing
License: GPL2
*/



// Create a settings page
function clb_add_settings_page() {
    add_options_page(
        'Custom Login Background & Styling', // Page title
        'Login Page Styling',  // Menu title
        'manage_options',      // Capability
        'custom-login-background', // Menu slug
        'clb_render_settings_page' // Function to display the settings page
    );
}
add_action('admin_menu', 'clb_add_settings_page');

// Render the settings page
function clb_render_settings_page() {
    ?>
    <div class="wrap">
        <h1>Custom Login Page Styling</h1>
        <p>Customize the login page colors and styling options below.</p>
        <form method="post" action="options.php">
            <?php
                settings_fields('clb_settings_group');
                do_settings_sections('custom-login-background');
                submit_button();
            ?>
        </form>
    </div>
    <?php
}

// Register settings, sections, and fields
function clb_settings_init() {
    register_setting('clb_settings_group', 'clb_background_color');
    register_setting('clb_settings_group', 'clb_accent_color');
    register_setting('clb_settings_group', 'clb_input_opacity');

    add_settings_section(
        'clb_settings_section', 
        'Customize Login Page Elements', 
        null, 
        'custom-login-background'
    );

    add_settings_field(
        'clb_background_color', 
        'Background Color', 
        'clb_background_color_callback', 
        'custom-login-background', 
        'clb_settings_section'
    );

    add_settings_field(
        'clb_accent_color', 
        'Accent Color', 
        'clb_accent_color_callback', 
        'custom-login-background', 
        'clb_settings_section'
    );

    add_settings_field(
        'clb_input_opacity', 
        'Input Field Opacity', 
        'clb_input_opacity_callback', 
        'custom-login-background', 
        'clb_settings_section'
    );
}
add_action('admin_init', 'clb_settings_init');

// Callback functions for each setting field
function clb_background_color_callback() {
    $color = get_option('clb_background_color', '#b5e272');
    echo '<input type="text" name="clb_background_color" value="' . esc_attr($color) . '" />';
}

function clb_accent_color_callback() {
    $color = get_option('clb_accent_color', '#009b63');
    echo '<input type="text" name="clb_accent_color" value="' . esc_attr($color) . '" />';
}

function clb_input_opacity_callback() {
    $opacity = get_option('clb_input_opacity', '0.5');
    echo '<input type="number" step="0.1" min="0" max="1" name="clb_input_opacity" value="' . esc_attr($opacity) . '" />';
}

// Enqueue the custom login CSS with dynamic styles
function clb_custom_login_css() {
    $background_color = get_option('clb_background_color', '#b5e272'); // Default background color
    $accent_color = get_option('clb_accent_color', '#009b63'); // Default accent color
    $input_opacity = get_option('clb_input_opacity', '0.5'); // Default input field opacity

    ?>
    <style type="text/css">
        /* Background Color */
        body.login {
            background-color: <?php echo esc_attr($background_color); ?> !important;
        }

        /* White Box (Login Form) */
        .login form {
            background: transparent !important;
            border: none !important;
            box-shadow: none !important;
        }

        /* Input Field Styling with Adjustable Opacity */
        .login input[type="text"], .login input[type="password"] {
            background: rgba(255, 255, 255, <?php echo esc_attr($input_opacity); ?>) !important;
        }

        /* Button Styling */
        .wp-core-ui .button-primary {
            background-color: <?php echo esc_attr($accent_color); ?> !important;
            border-color: <?php echo esc_attr($accent_color); ?> !important;
            color: #fff !important;
            font-weight: bold !important;
        }

        /* Button Hover - Movement */
        .wp-core-ui .button-primary:hover {
            transform: translateY(-2px);
        }

        /* Input Field Focus Border */
        .login input:focus {
            border-color: <?php echo esc_attr($accent_color); ?> !important;
            box-shadow: 0 0 2px 1px <?php echo esc_attr($accent_color); ?> !important;
        }

        /* Eye icon color */
        .login .dashicons-visibility {
            color: <?php echo esc_attr($accent_color); ?> !important;
        }

        /* Hyperlink hover color */
        .login #nav a:hover, .login #backtoblog a:hover {
            color: <?php echo esc_attr($accent_color); ?> !important;
        }
    </style>
    <?php
}
add_action('login_enqueue_scripts', 'clb_custom_login_css');

// Change the login logo link URL
function clb_login_logo_url() {
    return 'https://seedbed.com'; // Your desired URL
}
add_filter('login_headerurl', 'clb_login_logo_url');

Updated it to make it to make it a little more customizable should someone here want to use it.

<?php
/*
Plugin Name: Custom Login Background & Styling
Plugin URI: http://franklin.marketing
Description: An extention to theme.co's White Label add-on, a plugin to customize the login screen via settings.
Version: 1.0
Author: T.J. Miller
Author URI: http://franklin.marketing
License: GPLv3
*/



// Ensure functions exist before defining them
if (!function_exists('clb_add_settings_page')) {

// Create a settings page
function clb_add_settings_page() {
    add_options_page(
        'Custom Login Background & Styling', // Page title
        'Login Page Styling',  // Menu title
        'manage_options',      // Capability
        'custom-login-background', // Menu slug
        'clb_render_settings_page' // Function to display the settings page
    );
}
add_action('admin_menu', 'clb_add_settings_page');

// Render the settings page
function clb_render_settings_page() {
    ?>
    <div class="wrap">
        <h1>Custom Login Page Styling</h1>
        <p>Customize the login page colors and styling options below.</p>
        <form method="post" action="options.php">
            <?php
                settings_fields('clb_settings_group');
                do_settings_sections('custom-login-background');
                submit_button();
            ?>
        </form>
    </div>
    <?php
}

// Register settings, sections, and fields
function clb_settings_init() {
    register_setting('clb_settings_group', 'clb_background_color');
    register_setting('clb_settings_group', 'clb_accent_color');
    register_setting('clb_settings_group', 'clb_input_opacity');
    register_setting('clb_settings_group', 'clb_label_color');
    register_setting('clb_settings_group', 'clb_bold_label', ['default' => 0]);
    register_setting('clb_settings_group', 'clb_link_color');
    register_setting('clb_settings_group', 'clb_logo_url', ['default' => 'https://seedbed.com']);

    add_settings_section(
        'clb_settings_section', 
        'Customize Login Page Elements', 
        null, 
        'custom-login-background'
    );

    add_settings_field(
        'clb_background_color', 
        'Background Color', 
        'clb_background_color_callback', 
        'custom-login-background', 
        'clb_settings_section'
    );

    add_settings_field(
        'clb_accent_color', 
        'Accent Color', 
        'clb_accent_color_callback', 
        'custom-login-background', 
        'clb_settings_section'
    );

    add_settings_field(
        'clb_input_opacity', 
        'Input Field Opacity', 
        'clb_input_opacity_callback', 
        'custom-login-background', 
        'clb_settings_section'
    );

    add_settings_field(
        'clb_label_color', 
        'Label Color (Username & Password)', 
        'clb_label_color_callback', 
        'custom-login-background', 
        'clb_settings_section'
    );

    add_settings_field(
        'clb_bold_label', 
        'Make Username & Password Labels Bold?', // Label next to the checkbox
        'clb_bold_label_callback', 
        'custom-login-background', 
        'clb_settings_section'
    );

    add_settings_field(
        'clb_link_color', 
        'Label Color (Lost Your Password & ←)', 
        'clb_link_color_callback', 
        'custom-login-background', 
        'clb_settings_section'
    );

    add_settings_field(
        'clb_logo_url', 
        'Logo URL', 
        'clb_logo_url_callback', 
        'custom-login-background', 
        'clb_settings_section'
    );
}
add_action('admin_init', 'clb_settings_init');

// Callback functions for each setting field
function clb_background_color_callback() {
    $color = get_option('clb_background_color', '#b5e272');
    echo '<input type="text" name="clb_background_color" value="' . esc_attr($color) . '" />';
}

function clb_accent_color_callback() {
    $color = get_option('clb_accent_color', '#009b63');
    echo '<input type="text" name="clb_accent_color" value="' . esc_attr($color) . '" />';
}

function clb_input_opacity_callback() {
    $opacity = get_option('clb_input_opacity', '0.5');
    echo '<input type="number" step="0.1" min="0" max="1" name="clb_input_opacity" value="' . esc_attr($opacity) . '" />';
}

function clb_label_color_callback() {
    $label_color = get_option('clb_label_color', '#009b63');
    echo '<input type="text" name="clb_label_color" value="' . esc_attr($label_color) . '" />';
}

function clb_bold_label_callback() {
    $bold_label = get_option('clb_bold_label', 0);
    $checked = $bold_label ? 'checked' : '';
    echo '<input type="checkbox" name="clb_bold_label" value="1" ' . $checked . ' />';
}

function clb_link_color_callback() {
    $link_color = get_option('clb_link_color', '#009b63');
    echo '<input type="text" name="clb_link_color" value="' . esc_attr($link_color) . '" />';
}

function clb_logo_url_callback() {
    $logo_url = get_option('clb_logo_url', 'https://seedbed.com');
    echo '<input type="text" name="clb_logo_url" value="' . esc_attr($logo_url) . '" />';
}

// Enqueue the custom login CSS with dynamic styles
function clb_custom_login_css() {
    $background_color = get_option('clb_background_color', '#b5e272'); // Default background color
    $accent_color = get_option('clb_accent_color', '#009b63'); // Default accent color
    $input_opacity = get_option('clb_input_opacity', '0.5'); // Default input field opacity
    $label_color = get_option('clb_label_color', '#009b63'); // Default label color
    $bold_label = get_option('clb_bold_label', 0); // Bold label option
    $link_color = get_option('clb_link_color', '#009b63'); // Default link color
    $logo_url = get_option('clb_logo_url', 'https://seedbed.com'); // Default logo URL

    $bold_style = $bold_label ? 'font-weight: bold;' : '';

    ?>
    <style type="text/css">
        /* Background Color */
        body.login {
            background-color: <?php echo esc_attr($background_color); ?> !important;
        }

        /* White Box (Login Form) */
        .login form {
            background: transparent !important;
            border: none !important;
            box-shadow: none !important;
        }

        /* Input Field Styling with Adjustable Opacity */
        .login input[type="text"], .login input[type="password"] {
            background: rgba(255, 255, 255, <?php echo esc_attr($input_opacity); ?>) !important;
        }

        /* Label Styling (Username & Password) */
        .login label {
            color: <?php echo esc_attr($label_color); ?> !important;
            <?php echo $bold_style; ?>
        }

        /* Link Color (Lost Your Password & ←) */
        .login #nav a, .login #backtoblog a {
            color: <?php echo esc_attr($link_color); ?> !important;
        }

        /* Button Styling */
        .wp-core-ui .button-primary {
            background-color: <?php echo esc_attr($accent_color); ?> !important;
            border-color: <?php echo esc_attr($accent_color); ?> !important;
            color: #fff !important;
            font-weight: bold !important;
        }

        /* Button Hover - Movement */
        .wp-core-ui .button-primary:hover {
            transform: translateY(-2px);
        }

        /* Input Field Focus Border */
        .login input:focus {
            border-color: <?php echo esc_attr($accent_color); ?> !important;
            box-shadow: 0 0 2px 1px <?php echo esc_attr($accent_color); ?> !important;
        }

        /* Eye icon color */
        .login .dashicons-visibility {
            color: <?php echo esc_attr($accent_color); ?> !important;
        }

        /* Hyperlink hover color */
        .login #nav a:hover, .login #backtoblog a:hover {
            color: <?php echo esc_attr($accent_color); ?> !important;
        }
    </style>
    <?php
}
add_action('login_enqueue_scripts', 'clb_custom_login_css');

// Change the login logo link URL
function clb_login_logo_url() {
    $logo_url = get_option('clb_logo_url', 'https://seedbed.com');
    return esc_url($logo_url);
}
add_filter('login_headerurl', 'clb_login_logo_url');
}

Hey @franklinmarketing,

Thanks for sharing your idea. We will forward this to our developers and see if this can be implemented in future releases of the White Label plugin.

Cheers.

You’re welcome. Thanks. If they do care to look, here is my latest version.

<?php
/*
Plugin Name: Custom Login Background & Styling
Plugin URI: http://franklin.marketing
Description: An extention to theme.co's White Label add-on, a plugin to customize the login screen via settings.
Version: 1.2
Author: T.J. Miller
Author URI: http://franklin.marketing
License: GPLv3
*/



// Ensure functions exist before defining them
if (!function_exists('clb_add_settings_page')) {

    // Create a settings page
    function clb_add_settings_page() {
        add_options_page(
            'Custom Login Background & Styling', // Page title
            'Login Page Styling',  // Menu title
            'manage_options',      // Capability
            'custom-login-background', // Menu slug
            'clb_render_settings_page' // Function to display the settings page
        );
    }
    add_action('admin_menu', 'clb_add_settings_page');

    // Render the settings page
    function clb_render_settings_page() {
        ?>
        <div class="wrap">
            <h1>Custom Login Page Styling</h1>
            <p>This plugin is intended to be used as an extension to theme.co's Pro Theme Add-On, White Label. This plugin will provide some further design options to customize the login screen.</p>
            <form method="post" action="options.php">
                <?php
                    settings_fields('clb_settings_group');
                    do_settings_sections('custom-login-background');
                    submit_button();
                ?>
            </form>
            <div style="text-align: right; margin-top: 20px;">
                Created by <a href="https://franklin.marketing" target="_blank" style="text-decoration: none; font-weight: bold;">franklin.marketing</a>.<br />
                We are a collective of career marketers who want to serve small businesses through better marketing.
            </div>
        </div>
        <?php
    }

    // Register settings, sections, and fields
    function clb_settings_init() {
        register_setting('clb_settings_group', 'clb_background_color');
        register_setting('clb_settings_group', 'clb_accent_color');
        register_setting('clb_settings_group', 'clb_input_opacity');
        register_setting('clb_settings_group', 'clb_label_color');
        register_setting('clb_settings_group', 'clb_bold_label', ['default' => 0]);
        register_setting('clb_settings_group', 'clb_link_color');
        register_setting('clb_settings_group', 'clb_logo_url', ['default' => 'https://seedbed.com']);
        register_setting('clb_settings_group', 'clb_full_width_button', ['default' => 0]);

        add_settings_section(
            'clb_settings_section', 
            'Customize Login Page Elements', 
            null, 
            'custom-login-background'
        );

        add_settings_field(
            'clb_background_color', 
            'Background Color <span class="dashicons dashicons-editor-help" title="You can use White Label to add a PNG image as the upper layer and this color will change the default background color as the bottom layer."></span>', 
            'clb_background_color_callback', 
            'custom-login-background', 
            'clb_settings_section'
        );

        add_settings_field(
            'clb_accent_color', 
            'Accent Color', 
            'clb_accent_color_callback', 
            'custom-login-background', 
            'clb_settings_section'
        );

        add_settings_field(
            'clb_input_opacity', 
            'Input Field Opacity', 
            'clb_input_opacity_callback', 
            'custom-login-background', 
            'clb_settings_section'
        );

        add_settings_field(
            'clb_label_color', 
            'Label Color (Username & Password)', 
            'clb_label_color_callback', 
            'custom-login-background', 
            'clb_settings_section'
        );

        add_settings_field(
            'clb_bold_label', 
            'Make Username & Password Labels Bold?', 
            'clb_bold_label_callback', 
            'custom-login-background', 
            'clb_settings_section'
        );

        add_settings_field(
            'clb_link_color', 
            'Label Color (Lost Your Password & ←)', 
            'clb_link_color_callback', 
            'custom-login-background', 
            'clb_settings_section'
        );

        add_settings_field(
            'clb_logo_url', 
            'Logo URL', 
            'clb_logo_url_callback', 
            'custom-login-background', 
            'clb_settings_section'
        );

        add_settings_field(
            'clb_full_width_button', 
            'Enable Full-Width Button?', 
            'clb_full_width_button_callback', 
            'custom-login-background', 
            'clb_settings_section'
        );
    }
    add_action('admin_init', 'clb_settings_init');

    // Callback functions for each setting field
    function clb_background_color_callback() {
        $color = get_option('clb_background_color', '#b5e272');
        echo '<input type="text" name="clb_background_color" value="' . esc_attr($color) . '" />';
    }

    function clb_accent_color_callback() {
        $color = get_option('clb_accent_color', '#009b63');
        echo '<input type="text" name="clb_accent_color" value="' . esc_attr($color) . '" />';
    }

    function clb_input_opacity_callback() {
        $opacity = get_option('clb_input_opacity', '0.5');
        echo '<input type="number" step="0.1" min="0" max="1" name="clb_input_opacity" value="' . esc_attr($opacity) . '" />';
    }

    function clb_label_color_callback() {
        $label_color = get_option('clb_label_color', '#009b63');
        echo '<input type="text" name="clb_label_color" value="' . esc_attr($label_color) . '" />';
    }

    function clb_bold_label_callback() {
        $bold_label = get_option('clb_bold_label', 0);
        $checked = $bold_label ? 'checked' : '';
        echo '<input type="checkbox" name="clb_bold_label" value="1" ' . $checked . ' />';
    }

    function clb_link_color_callback() {
        $link_color = get_option('clb_link_color', '#009b63');
        echo '<input type="text" name="clb_link_color" value="' . esc_attr($link_color) . '" />';
    }

    function clb_logo_url_callback() {
        $logo_url = get_option('clb_logo_url', 'https://seedbed.com');
        echo '<input type="text" name="clb_logo_url" value="' . esc_attr($logo_url) . '" />';
    }

    function clb_full_width_button_callback() {
        $full_width_button = get_option('clb_full_width_button', 0);
        $checked = $full_width_button ? 'checked' : '';
        echo '<input type="checkbox" name="clb_full_width_button" value="1" ' . $checked . ' />';
    }

    // Enqueue the custom login CSS with dynamic styles and JavaScript
    function clb_custom_login_css() {
        $background_color = get_option('clb_background_color', '#b5e272'); // Default background color
        $accent_color = get_option('clb_accent_color', '#009b63'); // Default accent color
        $input_opacity = get_option('clb_input_opacity', '0.5'); // Default input field opacity
        $label_color = get_option('clb_label_color', '#009b63'); // Default label color
        $bold_label = get_option('clb_bold_label', 0); // Bold label option
        $link_color = get_option('clb_link_color', '#009b63'); // Default link color
        $logo_url = get_option('clb_logo_url', 'https://seedbed.com'); // Default logo URL
        $full_width_button = get_option('clb_full_width_button', 0); // Full-width button option

        $bold_style = $bold_label ? 'font-weight: bold;' : '';

        ?>
        <style type="text/css">
            /* Background Color */
            body.login {
                background-color: <?php echo esc_attr($background_color); ?> !important;
            }

            /* White Box (Login Form) */
            .login form {
                background: transparent !important;
                border: none !important;
                box-shadow: none !important;
            }

            /* Input Field Styling with Adjustable Opacity */
            .login input[type="text"], .login input[type="password"] {
                background: rgba(255, 255, 255, <?php echo esc_attr($input_opacity); ?>) !important;
            }

            /* Label Styling (Username & Password) - Apply color to Remember Me, exclude from bold */
            .login label {
                color: <?php echo esc_attr($label_color); ?> !important;
            }

            .login label:not([for="rememberme"]) {
                <?php echo $bold_style; ?>
            }

            /* Full-Width Button and Remember Me Positioning */
            <?php if ($full_width_button) : ?>
            .login .button-primary {
                width: 100% !important;
                margin-top: 10px !important;
                margin-bottom: 10px !important;
            }

            .login .forgetmenot {
                display: block;
                margin-top: 10px !important;
            }
            <?php endif; ?>

            /* Link Color (Lost Your Password & ←) */
            .login #nav a, .login #backtoblog a {
                color: <?php echo esc_attr($link_color); ?> !important;
                transition: transform 300ms ease-in-out, color 300ms ease-in-out; /* Material Standard */
            }

            .login #nav a:hover, .login #backtoblog a:hover {
                transform: translateY(-2px);
                color: <?php echo esc_attr($accent_color); ?> !important;
            }

            /* Button Styling */
            .wp-core-ui .button-primary {
                background-color: <?php echo esc_attr($accent_color); ?> !important;
                border-color: <?php echo esc_attr($accent_color); ?> !important;
                color: #fff !important;
                font-weight: bold !important;
                transition: transform 300ms ease-in-out; /* Material Standard */
            }

            /* Button Hover - Movement */
            .wp-core-ui .button-primary:hover {
                transform: translateY(-2px);
            }

            /* Input Field Focus Border */
            .login input:focus {
                border-color: <?php echo esc_attr($accent_color); ?> !important;
                box-shadow: 0 0 2px 1px <?php echo esc_attr($accent_color); ?> !important;
            }

            /* Eye icon color */
            .login .dashicons-visibility {
                color: <?php echo esc_attr($accent_color); ?> !important;
            }

            /* Logo Hover Effect */
            .login h1 a {
                transition: transform 300ms ease-in-out; /* Material Standard */
            }

            .login h1 a:hover {
                transform: translateY(-2px);
            }

            /* Add margin-top to logo on mobile */
            @media only screen and (max-width: 600px) {
                .login h1 {
                    margin-top: 25px !important;
                }
            }
        </style>

        <script type="text/javascript">
            document.addEventListener('DOMContentLoaded', function() {
                var rememberMe = document.querySelector('.forgetmenot');
                var submitButton = document.querySelector('.button-primary');
                if (rememberMe && submitButton) {
                    submitButton.insertAdjacentElement('afterend', rememberMe);
                }
            });
        </script>
        <?php
    }
    add_action('login_enqueue_scripts', 'clb_custom_login_css');

    // Change the login logo link URL
    function clb_login_logo_url() {
        $logo_url = get_option('clb_logo_url', 'https://franklin.marketing.com');
        return esc_url($logo_url);
    }
    add_filter('login_headerurl', 'clb_login_logo_url');
}

We really appreciate for sharing your code, @franklinmarketing.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.