无法使用WordPress中的选项框架创建选择选项

时间:2014-06-15 18:42:14

标签: php wordpress

我是WordPress的新用户。我在选项框架中遇到问题。我不能为我的使用做出选择。我想要一个包含用户可以选择的字体名称的框。这就是我在functions.options.php中使用此代码的原因:

$of_options[] = array(  "name"  => "Select Google Font",
                    "desc"  => "Normal Select Box.",
                     "id"   => "google_font_select",
                     "type" => "select",
                     "options" => array("PT Sans","Open Sans","Droid Sans")
                  ); 

但它并没有显示我的选择框。它在管理面板中显示如此图像。

enter image description here

请在这个问题上帮助我。

1 个答案:

答案 0 :(得分:0)

我刚刚在选项框架中使用了带有多个选项的select。这是我在我的一个项目中所做的。

首先,我为选择选项值制作了一个文本数组。

而且,这是实际的代码。我在我的网站上成功运行了。

$options[] = array(
        'name' => __('Services', 'ascent'),
        'type' => 'heading');

$text_array=array('java','c#','php');

    $options[] = array(
        'name' => __('Service Title', 'ascent'),
        'desc' => __('Change title', 'ascent'),
        'id' => 's_title1',
        'type' => 'select',
        'options'=>$text_array);

return $options;

希望,这将有助于您在项目中使用。