i'm trying to create options for my next wordpress theme but in this theme i use option tree plugin almost 80% options are css so i created a style.php
file and add it in header like other css files.
but i'm getting 500 server error and if i run file directly i get this error with 500 server error :
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.
Code of my style.php file :
<?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");
?>
I got my own answer I've syntax error in code but not showing in browser just show 500 internal server error
When i change
$option = ot_get_option('site_title')
to
$option = ot_get_option('site_title');
it works perfect
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.