I am trying to create a dynamic style.php stylesheet. The most basic function I am testing is a color picker on my theme-options. The color picker works, but my dynamic css file does not. On Chrome I am receiving a 'Illegal string offset' error when I inspect the nav element. I can confirm that it is recognizing and echoing the string, but not the value.

My dynamic css file:

  $absolute_path = explode('wp-content', $_SERVER['SCRIPT_FILENAME']);
  $wp_load = $absolute_path[0] . 'wp-load.php';

  $novus_nav_color = get_option('novus_nav_color');

  header('Content-type: text/css');
  header('Cache-control: must-revalidate');

.contain-to-grid .top-bar {
  background-color: <?php echo $novus_nav_color{'novus_nav_color'} ?>;

I am using Foundation 5 stock css. Site can be found here

Can anyone direct me on what I am doing wrong? Full error string is below:

.contain-to-grid .top-bar {
background-color: <br /> <b>Warning</b>: Illegal string offset 'novus_nav_color' in     <b>/home/flannelbeard/public_html/novus-theme/wp-content/themes/project.novus.theme/css/dynamic.style.php</b> on line <b>13</b><br /> #;

1 Answer 1


Wow I am an idiot. Ok, here is my error.

.contain-to-grid .top-bar {
  background-color: <?php echo $novus_nav_color; ?>;

I needed to just echo the variable and it was trying to call a string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.