Arrays 数组中的WordPress转换字符串
我创建了一个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' =&
// 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');