例如,我有以下代码:
<?php
$options = array(
array(
"type" => "section",
"icon" => "acera-icon-preference",
"title" => "General Settings",
"id" => "general",
"expanded" => "true"
),
array(
"under_section" => "ajax_login",
"type" => "checkbox",
"name" => "Who's Online Options",
"id" => array("tigu_whosonline_list", "tigu_whosonline_avatar"),
"display_checkbox_id" => "tigu_show_whosonline",
"img_desc" => "",
"options" => array("Who's Online List", "Who's Online Avatars"),
"desc" => "",
"default" => array("checked", "checked")
) );
?>
有更多数组,但我缩短了代码以节省空间。问题是:我怎样才能只包含以下代码
array(
"type" => "section",
"icon" => "acera-icon-preference",
"title" => "General Settings",
"id" => "general",
"expanded" => "true"
),
在有条件的情况下,如果有人认为像这样的代码(会出错):
if(function_exists('bp_is_active') ):
array(
"type" => "section",
"icon" => "acera-icon-preference",
"title" => "General Settings",
"id" => "general",
"expanded" => "true"
),
endif;
函数 bp_is_active 它检查是否安装了 BuddyPress 插件。仅当安装了 BuddyPress 插件时,我才需要在我的 wp 管理面板上显示该代码。
谢谢!