Browse Source

Prevent widgets panel customizer warning.

Kjell Reigstad 4 years ago
parent
commit
20c435e951
1 changed files with 4 additions and 1 deletions
  1. 4 1
      blank-canvas/functions.php

+ 4 - 1
blank-canvas/functions.php

@@ -111,11 +111,14 @@ add_action( 'customize_register', 'blank_canvas_remove_customizer_settings', 11
  */
 function blank_canvas_add_customizer_settings( $wp_customize ) {
 
+	// Cast the widgets panel as an object.
+	$customizer_widgets_panel = (object) $wp_customize->get_panel( 'widgets' );
+
 	// Add a Customizer message about the site title & tagline options.
 	$wp_customize->get_section( 'title_tagline' )->description  = __( 'The site logo, title, and tagline will only appear on single posts and pages if the “Site header and top menu" option is enabled in the Content Options section.', 'blank-canvas' );
 	$wp_customize->get_section( 'menu_locations' )->description = __( 'This theme will only display Menus if they are enabled in the Content Options section.', 'blank-canvas' );
 	$wp_customize->get_panel( 'nav_menus' )->description        = __( 'This theme will only display Menus if they are enabled in the Content Options section.', 'blank-canvas' );
-	$wp_customize->get_panel( 'widgets' )->description          = __( 'This theme will only display Widgets if they are enabled in the Content Options section.', 'blank-canvas' );
+	$customizer_widgets_panel->description                      = __( 'This theme will only display Widgets if they are enabled in the Content Options section.', 'blank-canvas' );
 }
 add_action( 'customize_register', 'blank_canvas_add_customizer_settings', 11 );