瀏覽代碼

Coutoire: Revise conditionals to fix array offset issue, cody tidying.

Allan Cole 5 年之前
父節點
當前提交
e63cef7036
共有 1 個文件被更改,包括 9 次插入9 次删除
  1. 9 9
      coutoire/functions.php

+ 9 - 9
coutoire/functions.php

@@ -58,11 +58,11 @@ if ( ! function_exists( 'coutoire_setup' ) ) :
 		 *
 		 * - if the customizer color is empty, use the default
 		 */
-		$colors_array = get_theme_mod('colors_manager'); // color annotations array()
-		$background   = $colors_array['colors']['bg'];   // $config-global--color-background-default;
-		$primary      = $colors_array['colors']['link']; // $config-global--color-primary-default;
-		$foreground   = $colors_array['colors']['txt'];  // $config-global--color-foreground-default;
-		$secondary    = $colors_array['colors']['fg1'];  // $config-global--color-secondary-default;
+		$colors_array = get_theme_mod( 'colors_manager' ); // color annotations array()
+		$primary      = ! empty( $colors_array ) ? $colors_array['colors']['link'] : '#0000FF'; // $config-global--color-primary-default;
+		$secondary    = ! empty( $colors_array ) ? $colors_array['colors']['fg1'] : '#FF0000';  // $config-global--color-secondary-default;
+		$foreground   = ! empty( $colors_array ) ? $colors_array['colors']['txt'] : '#444444';  // $config-global--color-foreground-default;
+		$background   = ! empty( $colors_array ) ? $colors_array['colors']['bg'] : '#FFFFFF';   // $config-global--color-background-default;
 
 		// Editor color palette.
 		add_theme_support(
@@ -71,22 +71,22 @@ if ( ! function_exists( 'coutoire_setup' ) ) :
 				array(
 					'name'  => __( 'Primary', 'coutoire' ),
 					'slug'  => 'primary',
-					'color' => ! isset($primary) ? '#0000FF' : $primary,
+					'color' => $primary,
 				),
 				array(
 					'name'  => __( 'Secondary', 'coutoire' ),
 					'slug'  => 'secondary',
-					'color' => ! isset($secondary) ? '#FF0000' : $secondary,
+					'color' => $secondary,
 				),
 				array(
 					'name'  => __( 'Foreground', 'coutoire' ),
 					'slug'  => 'foreground',
-					'color' => ! isset($foreground) ? '#444444' : $foreground,
+					'color' => $foreground,
 				),
 				array(
 					'name'  => __( 'Background', 'coutoire' ),
 					'slug'  => 'background',
-					'color' => ! isset($background) ? '#FFFFFF' : $background,
+					'color' => $background,
 				),
 			)
 		);