Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 数组中的WordPress转换字符串_Arrays_Wordpress_Localization_Translation - Fatal编程技术网

Arrays 数组中的WordPress转换字符串

Arrays 数组中的WordPress转换字符串,arrays,wordpress,localization,translation,Arrays,Wordpress,Localization,Translation,我创建了一个WordPress主题选项页面,其中所有选项/设置都在一个数组中。现在数组中的那些字符串拒绝被转换 我如何才能得到它,以便转换数组中的字符串 // create theme options global $cc_options; $cc_options = array ( // General settings array( 'name' => __('General', 'cc_language'), 'slug' =&

我创建了一个WordPress主题选项页面,其中所有选项/设置都在一个数组中。现在数组中的那些字符串拒绝被转换

我如何才能得到它,以便转换数组中的字符串

// create theme options
global $cc_options;
$cc_options = array (

// General settings
    array(  'name'      => __('General', 'cc_language'),
            'slug'      => 'general',
            'status'    => 'active',
            'type'      => 'section'),

    array(  'name'      => __('Setup some general settings for the website.', 'cc_language'),
            'type'      => 'section_desc'),

    array(  'type'      => 'open'),

    array(  'name'      => __('Breadcrumbs', 'cc_language'),
            'type'      => 'section_category'),

    array(  'name'      => __('Enable breadcrumbs', 'cc_language'),
            'desc'      => __('Check to enable breadcrumbs on pages and posts.', 'cc_language'),
            'id'        => 'breadcrumbs',
            'type'      => 'checkbox',
            'std'       => 'true'),

    array(  'type'      => 'close'),    
);

您的选项数组需要在wordpress初始化其翻译例程后定义。尝试将声明放在init操作挂钩中。

此代码是否发生在某个函数中?或者在functions.php中是这样的?不,在我的functions中是这样的!成功了!对于其他人,解决方案是:我将代码包装在
函数选项设置(){
添加操作('admin_init','options_setup');