title: Illegal string offset 'background-color' dynamic.css.php
body: <p>New!</p>
  
  <p>ok i deleted the bg options but now i get error from the font-family..</p>
  
  <pre><code>Warning: Illegal string offset 'font-family' in .../wp-content/themes/curves/includes/custom-css.php on line 20
  
  Warning: Illegal string offset 'font-family' in .../wp-content/themes/curves/includes/custom-css.php on line 26
  
  Warning: Illegal string offset 'font-family' in .../wp-content/themes/curves/includes/custom-css.php on line 31
  
  Warning: Illegal string offset 'font-family' in .../wp-content/themes/curves/includes/custom-css.php on line 37
  
  Warning: Illegal string offset 'font-family' in .../wp-content/themes/curves/includes/custom-css.php on line 42
  
  Warning: Illegal string offset 'font-family' in .../wp-content/themes/curves/includes/custom-css.php on line 47
  
  Warning: Illegal string offset 'font-family' in ..../wp-content/themes/curves/includes/custom-css.php on line 56
  </code></pre>
  
  <p>i think this is not writen well</p>
  
  <pre><code>$h1_font = ot_get_option( 'h1_font', 'lato' );
  
  $custom_css = "
  h1 { 
      font-family: ". $h1_font['font-family'] .";
      font-size: ". ot_get_option( 'h1_size', '24' ). "px;
      font-weight: 300;
  }
  </code></pre>
  
  <p>any help? thx</p>
  
  <hr>
  
  <p>Have some issues with PHP 5.4.. I have a friend who wrote the code for me because i only design and now the guy is unreachable and.. here i am :)</p>
  
  <p>So I have a <code>customcss.php</code> who creates a <code>dynamic.css</code> for a Wordpress theme. 
  I have installed the theme on host gator which has PHP 5.4 and i get this warnings:</p>
  
  <pre><code>Warning: Illegal string offset 'font-family' in /.../public_html/aaa/wp-       content/themes/curves/includes/custom-css.php on line 60
  
  Notice: Uninitialized string offset: 0 in /.../public_html/aaa/wp-content/themes/curves/includes/custom-css.php on line 20
  
  Warning: Illegal string offset 'background-color' in /home4/mthemes/public_html/aaa/wp-content/themes/curves/includes/custom-css.php on line 60
  
  Notice: Uninitialized string offset: 0 in /.../public_html/aaa/wp-content/themes/curves/includes/custom-css.php on line 60
  
  Warning: Illegal string offset 'background-repeat' in /.../public_html/aaa/wp-content/themes/curves/includes/custom-css.php on line 63
  
  Notice: Uninitialized string offset: 0 in /.../public_html/aaa/wp-content/themes/curves/includes/custom-css.php on line 63
  
  Warning: Illegal string offset 'background-attachment' in /.../public_html/aaa/wp-content/themes/curves/includes/custom-css.php on line 67
  </code></pre>
  
  <p>etc..</p>
  
  <pre><code>&lt;?php
  //custom inline css
  function curves_style_custom() {
   wp_enqueue_style(
    'custom-style',
    get_template_directory_uri() . '/dynamic.css'
   );
  
  $h1_font = ot_get_option( 'h1_font', 'lato' );
  $h2_font = ot_get_option( 'h2_font', 'lato' );
  $h3_font = ot_get_option( 'h3_font', 'lato' );
  $h4_font = ot_get_option( 'h4_font', 'lato' );
  $h5_font = ot_get_option( 'h5_font', 'lato' );
  $h6_font = ot_get_option( 'h6_font', 'lato' );
  $g_font = ot_get_option( 'g_font', 'lato' );
  
  
  $custom_css = "
  h1 { 
      font-family: ". $h1_font['font-family'] .";
      font-size: ". ot_get_option( 'h1_size', '24' ). "px;
      font-weight: 300;
  }
  
  h2 {     
      font-family: ". $h2_font['font-family'] .";
      font-size: ". ot_get_option( 'h2_size', '22' ) ."px;
      font-weight: 300;
  }
  
  h3 { 
      font-family: ". $h3_font['font-family'] .";
      font-size:". ot_get_option( 'h3_size', '18' ) ."px;
      font-weight: 300;
  
  }
  
  h4 { 
      font-family: ". $h4_font['font-family'] .";
      font-size: ". ot_get_option( 'h4_size', '16' ) ."px;
      font-weight: 300;
  }
  h5 { 
      font-family: ". $h5_font['font-family'] .";
      font-size: ". ot_get_option( 'h5_size', '12' ) ."px;
      font-weight: 300;
  }
  
  h6 { 
      font-family: ". $h6_font['font-family'] .";
      font-size: ". ot_get_option( 'h6_size', '10' ) ."px;
      font-weight: 300;
  }   
  
  p  { 
      font-size: ". ot_get_option( 'p_size', '14' ) ."px;
  }
  
  body{
      font-family: ". $g_font['font-family'] .";
  ";
  $body_bg = ot_get_option( 'body_bg_image' );
  
  if($body_bg['background-color'] != ""){
      $custom_css .= 'background-color: '. $body_bg['background-color'] .';';
  } 
  if($body_bg['background-repeat'] != ""){
      $custom_css .= 'background-repeat: '. $body_bg['background-repeat'] .';';
  }
  
  if($body_bg['background-attachment'] != ""){
      $custom_css .= 'background-attachment: '. $body_bg['background-attachment'] .';';
  }
  
  if($body_bg['background-position'] != ""){
      $custom_css .= 'background-position: '. $body_bg['background-position'] .';';
  }
  
  if($body_bg['background-size'] != ""){
      $custom_css .= 'background-size: '. $body_bg['background-size'] .';';
  }
  
  if($body_bg['background-image'] != ""){
      $custom_css .= 'background-image: url("'. $body_bg['background-image'] .'");';
  }
  
  $custom_css .= "}";
  </code></pre>
  
  <p>This code applies the option selected in admin (option tree) in an inline css.</p>
  
  <p>In PHP 5.3 it works but in PHP 5.4 it shows the warning.</p>
  
  <p>Also I discovered that this happens because, when I first install the theme, there are no option like <code>font-family</code> selected in option tree although as you ca see I set a default value.</p>