File: /www/wwwroot/shzthfdcpg.com/wp-content/themes/shzhaotao/options.php
<?php
/**
* A unique identifier is defined to store the options in the database and reference them from the theme.
* By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
* If the identifier changes, it'll appear as if the options have been reset.
*/
function optionsframework_option_name() {
// 从样式表获取主题名称
$themename = wp_get_theme();
$themename = preg_replace("/\W/", "_", strtolower($themename) );
$optionsframework_settings = get_option( 'optionsframework' );
$optionsframework_settings['id'] = $themename;
update_option( 'optionsframework', $optionsframework_settings );
}
/**
* 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 'options_framework_theme'
* with the actual text domain for your theme. 请阅读:
* 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' => __('logo设置', 'GJ') ,
'id' => 'logo_src',
"std" => '',
'type' => 'upload'
);
$options[] = array(
'name' => __('公司名称', 'GJ') ,
'id' => 'title',
"std" => '',
'type' => 'text'
);
$options[] = array(
'name' => __('热线电话', 'GJ') ,
'id' => 'phone',
"std" => '',
'type' => 'text'
);
$options[] = array(
'name' => __('备案号', 'GJ') ,
'id' => 'ba',
"std" => '',
'type' => 'text'
);
// 轮播图
$options[] = array(
'name' => __('轮播图设置', 'GJ') ,
'type' => 'heading'
);
for ($i = 1; $i <= 3; $i++) {
$options[] = array(
'name' => __('轮播图' . $i, 'GJ') ,
'desc' => __('大小:1920px*555px', 'GJ') ,
'id' => 'banner_src' . $i,
"std" => '',
'type' => 'upload'
);
$options[] = array(
'name' => __('轮播图(手机)' . $i, 'GJ') ,
'desc' => __('大小:1000px*555px', 'GJ') ,
'id' => 'banner_phone_src' . $i,
"std" => '',
'type' => 'upload'
);
$options[] = array(
'name' => __('轮播图链接', 'GJ') ,
'id' => 'banner_link' . $i,
"std" => '',
'type' => 'text'
);
}
/*分隔*/
$options[] = array(
'name' => __('自定义代码', 'GJ') ,
'type' => 'heading'
);
$options[] = array(
'name' => __('网站统计代码', 'Solome') ,
'desc' => __('位于底部,用于添加第三方流量数据统计代码,如:Google analytics、百度统计、CNZZ、51la,国内站点推荐使用百度统计,国外站点推荐使用Google analytics', 'Solome') ,
'id' => 'trackcode',
'std' => '',
'type' => 'textarea'
);
return $options;
}