我用过this nettuts tutorial 创建选项面板。当我尝试添加当前用户信息时,我正在尝试如何做,但迄今为止没有成功(我不断“破坏”代码/出现服务器错误)。。。我有3个自定义选项,我想提供给客户,而其余的只有管理员可用。我尝试在我的函数文件中添加此代码,但我提到了上面的错误。
if(current_user_can(\'manage_options\')) {
array( "name" => "Site Nav Background Image",
"type" => "section"),
array( "type" => "open"),
array( "name" => "Site Nav Background Image",
"desc" => "Paste URL for site navigation background image",
"id" => $shortname."_nav_bkg",
"type" => "text",
"std" => ""),
array( "type" => "close"),
} else {
array( "name" => "Custom CSS",
"type" => "section"),
array( "type" => "open"),
array( "name" => "Custom CSS",
"desc" => "Want to add any custom CSS code? Put in here, and the rest is taken care of. This overrides any other stylesheets. eg: a.button{color:green}",
"id" => $shortname."_custom_css",
"type" => "textarea",
"std" => ""),
array( "type" => "close"),
}
}
我还尝试创建了两个单独的选项函数,只有一个会显示出来。
有没有一个我错过的简单解决方案?有人能告诉我如何错误地使用上述代码吗?
TIA!