uo-login-default-css
Filters the default CSS for the user login screen, allowing modification of its appearance.
add_filter( 'uo-login-default-css', $callback, 10, 1 );
Description
Allows developers to modify or replace the default CSS applied to the frontend login form. This filter receives the default CSS string and can return a modified version or entirely new CSS to customize the login page's appearance. Use it to inject custom styles for login messages, form elements, or any other login-related elements.
Usage
add_filter( 'uo-login-default-css', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Customize the default CSS for the frontend login form.
*
* This filter allows developers to modify or replace the default CSS
* provided by the plugin for the frontend login form.
*
* @param string $default_css The default CSS string.
* @return string The modified or replaced CSS string.
*/
add_filter( 'uo-login-default-css', 'my_custom_login_css', 10, 1 );
function my_custom_login_css( $default_css ) {
// Let's add some custom styles to make the login form more prominent.
// We'll make the input fields slightly wider and add a subtle border.
$custom_styles = '
<style>
#loginform input[type="text"],
#loginform input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
box-sizing: border-box; /* Include padding and border in the element's total width and height */
}
#loginform p.forgetmenot label {
font-weight: normal;
}
</style>
';
// We can either append our styles to the default ones, or completely replace them.
// In this example, we'll append our custom styles.
return $default_css . $custom_styles;
// If you wanted to completely replace the default CSS, you would do this:
// return $custom_styles;
}
?>
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/classes/frontend-login-plus.php:1941
self::$login_error = apply_filters( 'uo_frontend_login_error', self::$login_error, $login, '', $message_warning );
// Prevent errors, some templates are using the following template
$login_error = self::$login_error;
$innerText = apply_filters( 'uo-login-inner-text', self::fetch_inner_text(), $login );
$default_css = apply_filters( 'uo-login-default-css', '<style>.login-msg{color:red;} .login-msg.loggedout{color:green;}#loginform label[for="user_login"],#loginform label[for="user_pass"] {display: block;}</style>' );
//Introducing different templates!
$template_to_load = apply_filters( 'uo-login-template', Config::get_settings_value( 'uo_frontend_login_template', 'FrontendLoginPlus', 'default' ) );
//Render Template
ob_start();