2012-11-09 107 views
-1

我想要我的下一个wordpress主题创建选项,但在这个主题我用选项树插件几乎80%的选项的CSS,所以我创建了一个style.php文件,并在像其他的CSS头添加它文件。获得500服务器错误的WordPress

但我得到500服务器错误,如果我运行文件直接我得到这个错误500服务器错误:

我style.php文件

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.

代码:

<?php ob_start(); 
    header("Content-type: text/css"); 
    include("../../../wp-load.php"); 
    header("HTTP/1.0 200 OK"); 
?> 
<?php 
    if(function_exists('ot_get_option')){ 
?> 
body{ 
    <?php 
     $option = ot_get_option('website_width'); 
     if(isset($option[0]) && isset($option[1])){ 
      echo "width:".$option[0].$option[1]; 
     } 
    ?>; 
} 

.span8{ 
    <?php 
     $option = ot_get_option('width_with_sidebar'); 
     if(isset($option[0]) && isset($option[1])){ 
      echo "width:".$option[0].$option[1]; 
     } 
    ?>; 
} 

.span6{ 
    <?php 
     $option = ot_get_option('content_width_with_two_sidebar'); 
     if(isset($option[0]) && isset($option[1])){ 
      echo "width:".$option[0].$option[1]; 
     } 
    ?>; 
} 

.span12{ 
    <?php 
     $option = ot_get_option('content_width_for_full_width'); 
     if(isset($option[0]) && isset($option[1])){ 
      echo "width:".$option[0].$option[1]; 
     } 
    ?>; 
} 

.span6,.span8,.span12{ 
    <?php 
     $option = ot_get_option('content_margins'); 
     if(isset($option[0]) && isset($option[1])){ 
      echo "margin:".$option[0].$option[1]; 
     } 
    ?>; 
    <?php 
     $option = ot_get_option('content_padding'); 
     if(isset($option[0]) && isset($option[1])){ 
      echo "padding:".$option[0].$option[1]; 
     } 
    ?>; 
} 

body{ 
    <?php 
     $option = ot_get_option('style'); 
     if(isset($option)){ 
      if($option=='full_width'){ 
       echo "width:100% !important"; 
      } 
     } 
    ?>; 
} 

#site-title{ 
    <?php 
     $option = ot_get_option('site_title') 
     if(isset($option)){ 
      if(isset($option['font-color'])){ 
       echo "color:".$option['font-color'].";"; 
      } 
      if(isset($option['font-family'])){ 
       echo "font-family:".$option['font-family'].";"; 
      } 
      if(isset($option['font-size'])){ 
       echo "font-size:".$option['font-size'].";"; 
      } 
      if(isset($option['font-variant'])){ 
       echo "font-variant:".$option['font-variant'].";"; 
      } 
      if(isset($option['font-weight'])){ 
       echo "font-weight:".$option['font-weight'].";"; 
      } 
      if(isset($option['letter-spacing'])){ 
       echo "letter-spacing:".$option['letter-spacing'].";"; 
      } 
      if(isset($option['line-height'])){ 
       echo "line-height:".$option['line-height'].";"; 
      } 
      if(isset($option['text-decoration'])){ 
       echo "text-decoration:".$option['text-decoration'].";"; 
      } 
      if(isset($option['text-transform'])){ 
       echo "text-transform:".$option['text-transform'].";"; 
      } 
     } 
    ?> 
} 
<?php 
    } 
header("HTTP/1.0 200 OK"); 
?> 
+0

我怀疑一个字符编码警告将是一个500错误的原因。你看过网络服务器错误日志中显示的内容吗? –

+0

“NetworkError:500内部服务器错误 - http://wptesting.wpengine.com/wp-content/themes/standard/style.php” style.php HTML文档的字符编码未声明。如果文档包含US-ASCII范围之外的字符,则该文档将在某些浏览器配置中呈现乱码文本。页面的字符编码必须在文档或传输协议中声明。 –

+0

yeesh。 WP因为缺乏编码而投掷500个?我猜WP编码器将核弹一个城市,因为在一个公寓的衣柜有几个苍蝇。 –

回答

0

我有了自己的答案 我有语法错误代码,但在浏览器中不显示只是显示500内部服务器错误

当我改变

$option = ot_get_option('site_title') 

$option = ot_get_option('site_title'); 

它的作品完美