File: /www/wwwroot/q.autos58.cn/wp-content/themes/kong20/inc/options/admin-options.php
<?php
function hua_csf_admin_options()
{
if (!is_admin()) return;
$prefix = 'hua_options';
//get分类
$categories = wp_cache_get('all_categories');
if (false === $categories) {
$cats = get_categories(['hide_empty' => false]);
foreach ($cats as $cat) {
$categories[$cat->term_id] = $cat->name;
}
wp_cache_set('all_categories', $categories);
}
$imagepath = get_template_directory_uri() . '/images/';
//开始构建
CSF::createOptions($prefix, array(
'framework_title' => '主题设置 <small></small>',
'show_bar_menu' => false,
'menu_title' => '主题设置',
'menu_slug' => 'hua_options',
'footer_text' => '华主题(huatheme.com)专注于WordPress高端企业主题制作',
'footer_credit' => '<i class="fa fa-fw fa-heart-o" aria-hidden="true"></i>感谢您使用 <a href="https://wordpress.org/" target="_blank">WordPress</a>和<a href="https://www.huatheme.com" target="_bank">华主题</a>进行创作。',
'theme' => 'light',
'show_reset_all' =>false, //重置主题默认设置
));
//
// 基本设置
//
CSF::createSection($prefix, array(
'title' => '基本设置',
'icon' => 'fa fa-bullseye',
'fields' => array(
array(
'id' => 'site_logo',
'title' => '网站Logo',
'desc' => '尺寸高度60px',
'default' => $imagepath . 'logo.png',
'preview' => true,
'library' => 'image',
'type' => 'upload'
),
array(
'id' => 'site_favicon',
'title' => 'ico图标',
'desc' => '浏览器上面的图标 建议48x48',
'default' => $imagepath . 'favicon.png',
'preview' => true,
'library' => 'image',
'type' => 'upload'
),
array(
'id' => 'site_email',
'title' => '投稿邮箱',
'type' => 'text',
'default' => '123@qq.com',
),
)
));
//
// SEO设置
//
CSF::createSection($prefix, array(
'title' => 'SEO设置',
'icon' => 'fa fa-superpowers',
'fields' => array(
array(
'id' => 'seo',
'type' => 'fieldset',
'title' => '首页SEO信息',
'fields' => array(
array(
'id' => 'web_title',
'type' => 'text',
'title' => '首页标题',
'desc' => '推荐50-60 个字符(一般不超过80个字符)',
'attributes' => array(
'style' => 'width: 100%;',
),
'default' => 'Huatheme主题_wordpress企业主题开发_专注于wordpress高端企业主题模板制作',
),
array(
'id' => 'web_keywords',
'type' => 'text',
'title' => '网站关键词',
'desc' => '推荐不超过 10 个关键词,用英文逗号隔开',
'attributes' => array(
'style' => 'width: 100%;',
),
'default' => '暂无,Huatheme,企业主题',
),
array(
'id' => 'web_description',
'type' => 'textarea',
'title' => '网站描述',
'default' => '企业网站首选的WordPress主题,各行业企业主题在Huatheme.com',
),
),
),
array(
'id' => 'connector',
'type' => 'text',
'title' => '全站链接符',
'desc' => '一经选择,切勿更改,对SEO不友好,一般为“-”或“_”',
'default' => '-',
),
array(
'id' => 'no_categoty',
'type' => 'switcher',
'title' => '分类去除category/前缀',
'label' => '',
'default' => true,
),
),
));
//
// 首页设置
//
// 首页设置: 布局设置
CSF::createSection($prefix, array(
'id' => 'home_fields',
'title' => '首页设置',
'icon' => 'fa fa-home',
'description' => '首页设置',
));
CSF::createSection($prefix, array(
'parent' => 'home_fields',
'title' => '——首页模块布局',
'icon' => 'fa fa-arrows-alt',
'fields' => array(
array(
'type' => 'notice',
'style' => 'success',
'content' => '自定义布局拖拽要启用的模块和排序,然后再模块参数设置具体参数即可。',
),
array(
'id' => 'home_mode',
'type' => 'sorter',
'title' => '',
'enabled_title' => '显示的模块',
'disabled_title' => '隐藏',
'default' => array(
'enabled' => array(
'one' => '版块一',
'two' => '版块二',
'three' => '版块三',
),
'disabled' => array(
),
),
),
),
));
CSF::createSection($prefix, array(
'title' => '——首页幻灯片版块',
'icon' => 'fas fa-image',
'parent' => 'home_fields',
'fields' => array(
array(
'id' => 'index-swiper-slide-t',
'type' => 'fieldset',
'title' => '首页上方置顶',
'fields' => array(
array(
'id' => 'category_mode',
'type' => 'select',
'title' => '分类选择模式',
'options' => array(
'all' => '全站文章',
'specific' => '选择特定分类',
),
'default' => 'all',
'desc' => '选择"全站文章"或手动指定多个分类',
),
array(
'id' => 'specific_categories', // 改为复数命名
'type' => 'select',
'title' => '选择分类(可多选)',
'placeholder' => '按住Ctrl/Cmd键多选',
'options' => 'hua_get_category_options',
'default' => array(), // 默认空数组
'multiple' => true, // 启用多选
'chosen' => true, // 启用美观的搜索下拉(需框架支持)
'dependency' => array('category_mode', '==', 'specific'), // 联动显示
'desc' => '可同时选择多个分类',
),
array(
'id' => 'get_is_zd',
'type' => 'switcher',
'title' => '只显示置顶',
'label' => '',
'default' => false,
),
array(
'id' => 'orderby',
'type' => 'select',
'title' => '排序方式',
'options' => array(
'date' => '日期',
'rand' => '随机',
'views' => '阅读量',
'modified' => '最近编辑时间',
'ID' => '文章ID',
),
),
),
),
array(
'id' => 'index-swiper-slide',
'type' => 'fieldset',
'title' => '首页左侧幻灯片',
'fields' => array(
array(
'id' => 'category_mode',
'type' => 'select',
'title' => '分类选择模式',
'options' => array(
'all' => '全站文章',
'specific' => '选择特定分类',
),
'default' => 'all',
'desc' => '选择"全站文章"或手动指定多个分类',
),
array(
'id' => 'specific_categories', // 改为复数命名
'type' => 'select',
'title' => '选择分类(可多选)',
'placeholder' => '按住Ctrl/Cmd键多选',
'options' => 'hua_get_category_options',
'default' => array(), // 默认空数组
'multiple' => true, // 启用多选
'chosen' => true, // 启用美观的搜索下拉(需框架支持)
'dependency' => array('category_mode', '==', 'specific'), // 联动显示
'desc' => '可同时选择多个分类',
),
array(
'id' => 'orderby',
'type' => 'select',
'title' => '排序方式',
'options' => array(
'date' => '日期',
'rand' => '随机',
'views' => '阅读量',
'modified' => '最近编辑时间',
'ID' => '文章ID',
),
),
),
),
array(
'id' => 'index-swiper-slider',
'type' => 'fieldset',
'title' => '首页幻灯片右侧',
'fields' => array(
array(
'id' => 'category_mode',
'type' => 'select',
'title' => '分类选择模式',
'options' => array(
'all' => '全站文章',
'specific' => '选择特定分类',
),
'default' => 'all',
'desc' => '选择"全站文章"或手动指定多个分类',
),
array(
'id' => 'specific_categories', // 改为复数命名
'type' => 'select',
'title' => '选择分类(可多选)',
'placeholder' => '按住Ctrl/Cmd键多选',
'options' => 'hua_get_category_options',
'default' => array(), // 默认空数组
'multiple' => true, // 启用多选
'chosen' => true, // 启用美观的搜索下拉(需框架支持)
'dependency' => array('category_mode', '==', 'specific'), // 联动显示
'desc' => '可同时选择多个分类',
),
array(
'id' => 'orderby',
'type' => 'select',
'title' => '排序方式',
'options' => array(
'date' => '日期',
'rand' => '随机',
'views' => '阅读量',
'modified' => '最近编辑时间',
'ID' => '文章ID',
),
),
),
),
)
));
CSF::createSection($prefix, array(
'parent' => 'home_fields',
'title' => '——版块一',
'icon' => 'fa fa-ellipsis-v',
'fields' => array(
array(
'id' => 'index-one',
'type' => 'fieldset',
'title' => '首页版块一',
'fields' => array(
array(
'id' => 'category_mode',
'type' => 'select',
'title' => '分类选择模式',
'placeholder' => '选择一个分类',
'options' => 'categories',
'desc' => '请选择指定分类,不选择显示全站文章',
),
array(
'id' => 'orderby',
'type' => 'select',
'title' => '排序方式',
'options' => array(
'date' => '日期',
'rand' => '随机',
'views' => '阅读量',
'modified' => '最近编辑时间',
'ID' => '文章ID',
),
),
),
),
array(
'id' => 'index-one-bl',
'type' => 'fieldset',
'title' => '首页版块一下左',
'fields' => array(
array(
'id' => 'category_mode',
'type' => 'select',
'title' => '分类选择模式',
'placeholder' => '选择一个分类',
'options' => 'categories',
'desc' => '请选择指定分类,不选择显示全站文章',
),
array(
'id' => 'orderby',
'type' => 'select',
'title' => '排序方式',
'options' => array(
'date' => '日期',
'rand' => '随机',
'views' => '阅读量',
'modified' => '最近编辑时间',
'ID' => '文章ID',
),
),
),
),
array(
'id' => 'index-one-br',
'type' => 'fieldset',
'title' => '首页版块一下右',
'fields' => array(
array(
'id' => 'category_mode',
'type' => 'select',
'title' => '分类选择模式',
'placeholder' => '选择一个分类',
'options' => 'categories',
'desc' => '请选择指定分类,不选择显示全站文章',
),
array(
'id' => 'orderby',
'type' => 'select',
'title' => '排序方式',
'options' => array(
'date' => '日期',
'rand' => '随机',
'views' => '阅读量',
'modified' => '最近编辑时间',
'ID' => '文章ID',
),
),
),
),
array(
'id' => 'index-one-r',
'type' => 'fieldset',
'title' => '首页版块一右',
'subtitle' => '此版块显示14篇文章',
'fields' => array(
array(
'id' => 'category_mode',
'type' => 'select',
'title' => '分类选择模式',
'placeholder' => '选择一个分类',
'options' => 'categories',
'desc' => '请选择指定分类,不选择显示全站文章',
),
array(
'id' => 'orderby',
'type' => 'select',
'title' => '排序方式',
'options' => array(
'date' => '日期',
'rand' => '随机',
'views' => '阅读量',
'modified' => '最近编辑时间',
'ID' => '文章ID',
),
),
),
),
)
));
CSF::createSection($prefix, array(
'parent' => 'home_fields',
'title' => '——版块二',
'icon' => 'fa fa-ellipsis-v',
'fields' => array(
array(
'id' => 'index-two',
'type' => 'fieldset',
'title' => '首页版块二',
'fields' => array(
array(
'id' => 'category_mode',
'type' => 'select',
'title' => '分类选择模式',
'placeholder' => '选择一个分类',
'options' => 'categories',
'desc' => '请选择指定分类,不选择显示全站文章',
),
array(
'id' => 'orderby',
'type' => 'select',
'title' => '排序方式',
'options' => array(
'date' => '日期',
'rand' => '随机',
'views' => '阅读量',
'modified' => '最近编辑时间',
'ID' => '文章ID',
),
),
),
),
)
));
CSF::createSection($prefix, array(
'parent' => 'home_fields',
'title' => '——版块三',
'icon' => 'fa fa-ellipsis-v',
'fields' => array(
array(
'id' => 'index-three',
'type' => 'fieldset',
'title' => '首页版块三',
'fields' => array(
array(
'id' => 'category_mode',
'type' => 'select',
'title' => '分类选择模式',
'placeholder' => '选择一个分类',
'options' => 'categories',
'desc' => '请选择指定分类,不选择显示全站文章',
),
array(
'id' => 'orderby',
'type' => 'select',
'title' => '排序方式',
'options' => array(
'date' => '日期',
'rand' => '随机',
'views' => '阅读量',
'modified' => '最近编辑时间',
'ID' => '文章ID',
),
),
),
),
array(
'id' => 'index-three-m',
'type' => 'fieldset',
'title' => '首页版块三中间',
'fields' => array(
array(
'id' => 'category_mode',
'type' => 'select',
'title' => '分类选择模式',
'placeholder' => '选择一个分类',
'options' => 'categories',
'desc' => '请选择指定分类,不选择显示全站文章',
),
array(
'id' => 'orderby',
'type' => 'select',
'title' => '排序方式',
'options' => array(
'date' => '日期',
'rand' => '随机',
'views' => '阅读量',
'modified' => '最近编辑时间',
'ID' => '文章ID',
),
),
),
),
array(
'id' => 'index-three-r',
'type' => 'fieldset',
'title' => '首页版块三右侧',
'fields' => array(
array(
'id' => 'category_mode',
'type' => 'select',
'title' => '分类选择模式',
'placeholder' => '选择一个分类',
'options' => 'categories',
'desc' => '请选择指定分类,不选择显示全站文章',
),
array(
'id' => 'orderby',
'type' => 'select',
'title' => '排序方式',
'options' => array(
'date' => '日期',
'rand' => '随机',
'views' => '阅读量',
'modified' => '最近编辑时间',
'ID' => '文章ID',
),
),
),
),
)
));
CSF::createSection($prefix, array(
'parent' => 'home_fields',
'title' => '——友情链接',
'icon' => 'fa fa-ellipsis-v',
'fields' => array(
array(
'id' => 'get_is_links',
'type' => 'switcher',
'title' => '显示友情链接',
'label' => '',
'default' => true,
),
)
));
//
// 列表页设置
//
CSF::createSection($prefix, array(
'title' => '列表文章',
'icon' => 'fa fa-map-o',
'fields' => array(
array(
'id' => '_site_excerpt_length',
'type' => 'text',
'title' => '列表摘要字数',
'dsec' => '统一字数可以解决摘要文字太多不美观问题',
'default' => '100',
),
array(
'id' => 'hua_cat_time',
'type' => 'switcher',
'title' => '发布时间',
'label' => '',
'default' => true,
),
),
));
//
// 内容页设置
//
CSF::createSection($prefix, array(
'title' => '内容页设置',
'icon' => 'fa fa-superpowers',
'fields' => array(
array(
'id' => 'sing_tag_link',
'type' => 'switcher',
'title' => '内容关联tags',
'default' => true,
),
array(
'id' => 'huakey',
'type' => 'group',
'max' => 4,
'button_title' => '继续添加关键词',
'title' => '添加关键词内链',
'subtitle' => '网站的重点关键词、核心关键词做内链',
'default' => array(
array(
'text' => 'wordpress主题',
'link' => array(
'url' => 'https://www.huatheme.com/',
),
),
),
'fields' => array(
array(
'id' => 'text',
'title' => '关键词',
'type' => 'text'
),
array(
'id' => 'link',
'type' => 'link',
'title' => '链接',
'add_title' => '添加链接',
'edit_title' => '编辑链接',
'remove_title' => '删除链接',
),
),
),
),
));
//
// 头部设置
//
CSF::createSection($prefix, array(
'title' => '头部设置',
'icon' => 'fa fa-clone',
'fields' => array(
array(
'id' => 'headad',
'type' => 'group',
'title' => '广告图',
'accordion_title_auto' => true,
'max'=>2,
'min'=>2,
'button_title'=> 'no',
'default' => array(
array(
'_title' => '广告图',
'_img' => $imagepath . 'headad1.jpg',
'_href' => '/',
),
array(
'_title' => '广告图',
'_img' => $imagepath . 'headad2.jpg',
'_href' => '/',
),
),
'fields' => array(
array(
'id' => '_title',
'type' => 'text',
'title' => '标题',
'default' => '广告图',
),
array(
'id' => '_img',
'type' => 'upload',
'library' => 'image',
'placeholder' => 'http://',
'preview' => true,
'default' => $imagepath . 'headad1.jpg',
),
array(
'id' => '_href',
'type' => 'text',
'title' => '链接地址',
'default' => '/',
),
),
),
array(
'id' => 'site_gzh',
'title' => '公众号二维码',
'default' => $imagepath . 'gzh.png',
'preview' => true,
'library' => 'image',
'type' => 'upload'
),
array(
'id' => 'web_css',
'type' => 'code_editor',
'title' => '自定义CSS样式代码',
'before' => '<p class="csf-text-muted"><strong>位于顶部,自定义修改CSS</strong>不用添加<strong><style></strong>标签</p>',
'settings' => array(
'mode' => 'css',
'theme' => 'dracula',
),
'sanitize' => false,
'default' => '',
),
)
));
//
// 底部设置
//
CSF::createSection($prefix, array(
'title' => '底部设置',
'icon' => 'fa fa-clone',
'fields' => array(
array(
'id' => 'hua_copyright_text',
'type' => 'textarea',
'title' => '底部版权信息',
'subtitle' => '自定义版权信息',
'default' => 'Copyright © 2026 <a href="https://www.huatheme.com" target="_blank">huatheme</a>. All Rights Reserved.',
),
array(
'id' => 'hua_ipc_info',
'type' => 'text',
'title' => '网站备案号',
'subtitle' => '',
'default' => '京ICP备18888888号 ',
),
array(
'id' => 'site_ipc2_text',
'type' => 'textarea',
'sanitize' => false,
'title' => '网站公安备案链接',
'subtitle' => '',
'default' => '<a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=188888888" target="_blank" rel="noreferrer nofollow">京公网安备 188888888</a>',
),
array(
'id' => 'web_js',
'type' => 'code_editor',
'title' => '网站底部自定义JS代码',
'subtitle' => '位于底部,用于添加第三方流量数据统计代码,如:Google analytics、百度统计、CNZZ,例如:' . esc_attr('<script>统计代码</script>'),
'sanitize' => false,
'default' => '',
'settings' => array(
'mode' => 'javascript',
'theme' => 'dracula',
),
),
)
));
// 缩略图设置
//
CSF::createSection($prefix, array(
'title' => '缩略图',
'icon' => 'fa fa-fw fa-image',
'fields' => array(
array(
'id' => 'thumb_shapeSpace_disable',
'type' => 'switcher',
'title' => '媒体图像',
'label' => 'wordpress默认会自动生成很多不同尺寸的媒体图片(7张),会占用我们主机服务器的大量空间,关闭后仅上传原图。',
'default' => false,
),
array(
'id' => 'thumbnail_def_get_size',
'type' => 'radio',
'title' => '默认获取缩略图尺寸',
'desc' => '尺寸宽高可在后台-设置-媒体中修改,根据网站布局设置您最佳的尺寸)',
'options' => array(
'thumbnail' => '小尺寸',
'medium' => '中等大小',
'large' => '大尺寸',
'full' => '原图',
),
'default' => 'full',
),
array(
'id' => 'post_default_thumb',
'type' => 'upload',
'title' => '默认缩略图(暂无图片)',
'library' => 'image',
'add_title' => '上传默认缩略图',
'desc' => '有特色图像显示特色图像,没有特色图像则显示文章内第一张图片(开启状态),文章内没有图片显示此处设置的图',
'preview' => true,
'default' => $imagepath . 'no-img.jpg',
),
array(
'id' => 'thumb_postfirstimg_s',
'type' => 'switcher',
'title' => '文章内第一张为缩略图',
'label' => '文章内第一张图片显示为缩略图,关闭后,显示上面的默认缩略图',
'default' => true,
),
array(
'id' => 'enable_remote_image_localization',
'type' => 'switcher',
'title' => '远程图片本地化',
'label' => '发布文章时自动将远程图片保存到本地服务器',
'default' => false,
),
/*array(
'id' => 'set_postthumbnail',
'type' => 'switcher',
'title' => '文章第一张图片自动保存为特色图像',
'label' => '本地上传的第一张图片为特色图像',
'default' => true,
),*/
)
));
//
// 辅助其他
//
CSF::createSection($prefix, array(
'title' => '其他设置',
'icon' => 'fa fa-fw fa-gavel',
'description' => '',
'fields' => array(
array(
'id' => 'display_wp_update',
'type' => 'switcher',
'default' => false,
'title' => 'WordPress检测更新'
),
array(
'id' => 'disable_gutenberg_edit',
'type' => 'switcher',
'title' => '古滕堡编辑器',
'default' => false,
),
array(
'id' => 'disable_admin_bar',
'type' => 'switcher',
'title' => '顶部工具栏',
'default' => true,
),
array(
'id' => 'md5_file_udpate',
'type' => 'switcher',
'title' => '上传文件MD5加密重命名',
'default' => true,
),
)
));
//
// 概要
//
CSF::createSection($prefix, array(
'title' => '主题概要',
'icon' => 'fas fa-rocket',
'fields' => array(
array(
'type' => 'submessage',
'style' => 'light',
'content' => '<h3 style="color:#fd4c73;"><i class="fa fa-heart fa-fw"></i> 感谢您的使用</h3>
<div><b>一对一全方位的个性化定制,帮您解决难题。</b></div>
<div style="margin:10px 14px;">
<li>主题模版修改,仿制,定制</li>
<li>微信号:huatheme(方便沟通)</li>
<li>QQ号:1005899156</li>
</div><p>更多主题模版官网:<a target="_bank" href="https://www.huatheme.com/">wordpress主题模版</a></p>
',
),
array(
'id' => 'hua_key',
'type' => 'text',
'title' => '永久验证码',
'attributes' => array(
'type' => 'password',
'autocomplete' => 'off',
),
),
array(
'type' => 'submessage',
'style' => '',
'content' => '请支持正版,不要相信所谓破解等盗版,发现盗版将取消主题验证码。填写错误顶部会提示消息,成功则不显示。
',
),
)
));
//
// Field: backup
//
CSF::createSection($prefix, array(
'title' => '主题备份&导入',
'icon' => 'fa fa-fw fa-copy',
'fields' => array(
array(
'type' => 'submessage',
'style' => 'warning',
'content' => '<div style="margin:10px 14px;"><li>仅备份该页面主题设置所有选项设置数据,并不备份wp自有的文章等数据</li><li>提示说明:此处备份中保存的数据格式是字符串类型,有长度验证,切勿修改字符串导致乱码,如需修改请原封不动导入进去在设置页码输入框修改</li></div>',
),
array(
'type' => 'backup',
),
),
));
}
hua_csf_admin_options();