File: /data/wwwroot/wordpress/wp-content/themes/yantou/options.php
<?php
/**
* A unique identifier is defined to store the options in the database and reference them from the theme.
*/
function optionsframework_option_name() {
// Change this to use your theme slug
return 'options-framework-theme';
}
/**
* Defines an array of options that will be used to generate the settings page and be saved in the database.
* When creating the 'id' fields, make sure to use all lowercase and no spaces.
*
* If you are making your theme translatable, you should replace 'theme-textdomain'
* with the actual text domain for your theme. Read more:
* http://codex.wordpress.org/Function_Reference/load_theme_textdomain
*/
function optionsframework_options() {
// 将所有分类(categories)加入数组
$options_categories = array();
$options_categories_obj = get_categories();
foreach ($options_categories_obj as $category) {
$options_categories[$category->cat_ID] = $category->cat_name;
}
$options = array();
$options[] = array(
'name' => __('全站设置', 'GJ') ,
'type' => 'heading'
);
$options[] = array(
'name' => __('公司名称', 'GJ') ,
'id' => 'company_name',
'type' => 'text'
);
$options[] = array(
'name' => __('公司地址', 'GJ') ,
'id' => 'address',
'type' => 'text'
);
$options[] = array(
'name' => __('手机号码', 'GJ') ,
'id' => 'shouji_tel',
'type' => 'text'
);
$options[] = array(
'name' => __('联系人', 'GJ') ,
'id' => 'lxr',
'type' => 'text'
);
$options[] = array(
'name' => __('邮箱', 'GJ') ,
'id' => 'email',
'type' => 'text'
);
$options[] = array(
'name' => __('ICP备案号', 'GJ') ,
'id' => 'icp_number',
'type' => 'text'
);$options[] = array('name' => __('关于我们图片', 'GJ') ,'id' => 'gywmimg' ,'type' => 'upload'
);
$options[] = array(
'name' => __('公司介绍', 'GJ') ,
'id' => 'gsjs',
'type' => 'textarea'
);
$options[] = array(
'name' => __('未来发展', 'GJ') ,
'id' => 'wlfz',
'type' => 'textarea'
);
$options[] = array(
'id' => 'wlfzimg',
'desc' => __('未来发展背景', 'GJ') ,
'type' => 'upload'
);
/*******分隔*******/
$options[] = array(
'name' => __('Banner1', 'GJ') ,
'type' => 'heading'
);
$options[] = array(
'id' => 'banner_index1',
'desc' => __('首页1', 'GJ') ,
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_index2',
'desc' => __('首页2', 'GJ') ,
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_index3',
'desc' => __('首页3', 'GJ') ,
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_news',
'desc' => __('新闻中心', 'GJ') ,
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_products',
'desc' => __('产品中心', 'GJ') ,
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_about',
'desc' => __('关于我们', 'GJ') ,
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_contact',
'desc' => __('联系我们', 'GJ') ,
'type' => 'upload'
);
return $options;
}