From fdbc5b583c246124e5ba461b20f1ab8c7232f070 Mon Sep 17 00:00:00 2001 From: Austin Passy <367897+thefrosty@users.noreply.github.com> Date: Thu, 17 Oct 2024 10:41:55 -0700 Subject: [PATCH] Update login css target for WordPress >= 6.7. (#117) --- resources/views/wp-login/style.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/resources/views/wp-login/style.php b/resources/views/wp-login/style.php index bdcefc8..3a8fec6 100644 --- a/resources/views/wp-login/style.php +++ b/resources/views/wp-login/style.php @@ -11,10 +11,7 @@ exit; } -if (!defined('SHORTINIT')) { - define('SHORTINIT', true); -} - +$login_h1 = version_compare($GLOBALS['wp_version'], '6.7', '>=') ? '.login .wp-login-logo' : '.login h1'; $version ??= CustomLogin::VERSION; $close_rule = "}\n"; @@ -136,20 +133,20 @@ /** * Open login h1 - * @rule .login h1 + * @rule .login h1 / .login .wp-login-logo */ if ((!empty($logo_force_form_max_width) && $logo_force_form_max_width === OptionValue::ON) && !empty($login_form_width)) { - $css .= openCssRule('.login h1'); + $css .= openCssRule($login_h1); $css .= trailingSemicolonIt('width', sprintf('%1$s%2$s', $login_form_width, $login_form_width_unit ?? 'px')); - $css .= $close_rule; // CLOSE .login + $css .= $close_rule; // CLOSE .login h1 / .login .wp-login-logo } /** * Open login h1 a - * @rule .login h1 a + * @rule .login h1 a / .login .wp-login-logo a */ if (!empty($logo_background_url)) { - $css .= openCssRule('.login h1 a'); + $css .= openCssRule("$login_h1 a"); if (!empty($logo_background_size_width)) { $css .= trailingSemicolonIt('width', sprintf('%1$spx !important', $logo_background_size_width)); } @@ -167,7 +164,7 @@ } else { $css .= prefixIt('background-size', 'inherit'); } - $css .= $close_rule; // CLOSE .login h1 a + $css .= $close_rule; // CLOSE .login h1 a / .login .wp-login-logo a } /**