File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ class WP_Admin_Bar {
3232 * Initializes the admin bar.
3333 *
3434 * @since 3.1.0
35+ * @since 7.0.0 Enqueues the admin color scheme stylesheet on the front end.
36+ *
37+ * @global array $_wp_admin_css_colors
3538 */
3639 public function initialize () {
3740 $ this ->user = new stdClass ();
@@ -72,6 +75,27 @@ public function initialize() {
7275 wp_enqueue_script ( 'admin-bar ' );
7376 wp_enqueue_style ( 'admin-bar ' );
7477
78+ if ( ! is_admin () ) {
79+ global $ _wp_admin_css_colors ;
80+
81+ if ( empty ( $ _wp_admin_css_colors ) ) {
82+ register_admin_color_schemes ();
83+ }
84+
85+ $ color_scheme = get_user_option ( 'admin_color ' );
86+
87+ if ( empty ( $ color_scheme ) || ! isset ( $ _wp_admin_css_colors [ $ color_scheme ] ) ) {
88+ $ color_scheme = 'modern ' ;
89+ }
90+
91+ $ color = $ _wp_admin_css_colors [ $ color_scheme ] ?? null ;
92+ $ url = $ color ->url ?? '' ;
93+
94+ if ( $ url ) {
95+ wp_enqueue_style ( 'admin-bar-colors ' , $ url , array ( 'admin-bar ' ) );
96+ }
97+ }
98+
7599 /**
76100 * Fires after WP_Admin_Bar is initialized.
77101 *
You can’t perform that action at this time.
0 commit comments