我的wp管理页面有问题,它只是显示为空白。我很确定这与我的功能有关。php文件顶部或底部没有空格,但当我完全删除它时,wp admin文件夹再次工作。
下面是函数。php文件
<?php
add_action("manage_posts_custom_column", "booktime_custom_columns");
add_filter("manage_edit-booktime_columns", "booktime_edit_columns");
function booktime_custom_columns($column){
global $post;
switch ($column) {
case "name":
the_excerpt();
break;
case "address":
$custom = get_post_custom();
echo $custom["address"][0];
break;
case "phone":
$custom = get_post_custom();
echo $custom["phone"][0];
break;
case "date":
$custom = get_post_custom();
echo $custom["date"][0];
break;
case "bottles":
$custom = get_post_custom();
echo $custom["bottles"][0];
break;
}
}
function booktime_edit_columns($columns){
$columns = array(
"cb" => "<input type=\\"checkbox\\" />",
"title" => "Post should show",
"description" => "name",
"address" => "address",
"phone" => "phone",
"date" => "date",
"bottles" => "bottles"
);
return $columns;
}
?>
<?php
add_action("admin_init", "admin_init_booktime");
function admin_init_booktime(){
add_meta_box("name", "name", "name", "booktime", "normal", "low");
}
?>
<?php
function name() {
global $post;
$custom = get_post_custom($post->ID);
$name = ( !empty($custom["name"][0]) ) ? $custom["name"][0]: "";
?>
<p><label>Name:</label><br />
<input type="text" name="name" value="<?php echo $name; ?>"/></p>
<?php
}
?>
<?php
add_action(\'save_post\', \'save_details_booktime\');
function save_details_booktime(){
global $post;
$custom_meta_fields = array( \'name\' );
foreach( $custom_meta_fields as $custom_meta_field ):
if(isset($_POST[$custom_meta_field]) && $_POST[$custom_meta_field] != ""):
update_post_meta($post->ID, $custom_meta_field, $_POST[$custom_meta_field]);
endif;
endforeach;
}
?>
编辑:我打开了wp config debug,得到了以下结果
Parse error: syntax error, unexpected \'<\' in /Users/anderskitson/Sites/fiftyfity/wp-content/themes/fiftyfityNew/functions.php on line 61
SO网友:Chip Bennett
您需要删除所有关闭/打开PHP标记之间的空格,包括:
}
?>
<?php
add_action(\'save_post\', \'save_details_booktime\');
以及
}
?>
<?php
function name() {
以及
}
?>
<?php
add_action("admin_init", "admin_init_booktime");
(请检查您的文件;可能不包括所有内容。)
编辑
除了@m0r7if3r的好答案之外,我还建议您使用以下方法来解决问题:
从中删除所有内容functions.php
添加一个打开的<?php
标签做not 在每个功能中添加一个结束标记,每次添加一个,直到找到一个导致站点WSOD的结束标记
修复该功能的问题继续使用剩余的每个功能,一次一个,直到您恢复了所有功能