File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -218,10 +218,23 @@ public function get_asset_data( string $file ): array {
218218 }
219219
220220 /**
221- * Change login CSS URL
222- * @return string
221+ * Point the login page stylesheet to the built CSS in `dist/` when available.
222+ *
223+ * @param string $stylesheet_path Default path relative to the theme root (from `wp_login_page_theme_css`).
224+ *
225+ * @return string Path relative to the theme root.
223226 */
224- public function login_stylesheet_uri (): string {
225- return 'dist/ ' . $ this ->get_min_file ( 'login ' );
227+ public function login_stylesheet_uri ( string $ stylesheet_path = '' ): string {
228+ $ file = $ this ->get_min_file ( 'login ' );
229+
230+ if ( ! empty ( $ file ) && file_exists ( \get_theme_file_path ( '/dist/ ' . $ file ) ) ) {
231+ return 'dist/ ' . $ file ;
232+ }
233+
234+ if ( file_exists ( \get_theme_file_path ( '/dist/login.css ' ) ) ) {
235+ return 'dist/login.css ' ;
236+ }
237+
238+ return $ stylesheet_path ;
226239 }
227240}
You can’t perform that action at this time.
0 commit comments