此次对主题的修改操作主要涉及index.php、options.php以及css文件夹中的main.css,并且我们需要新建一个名为 qgg_recent_posts_most 的php文件填写相关代码丢到主题的modules文件加下,在主题修改之前还是提醒大家备份一下相关文件以防误操作引起的网站崩溃。
options.php文件修改
DUX主题以及大前端的其他一些主题都是使用 Options Framework 框架添加后台设置选项的,所以说如果有想学习并且想以后自行添加后台设置选项的可以先了解一下 Options Framework 。这里我们只需要将下面这段代码添加到主题 options.php 文件的末尾 return $options; 之前即可。
/**
自定义后台设置
*/
$options[] = array(
'name' => __('风神功能', 'haoui'),
'type' => 'heading');
$options[] = array(
'name' => __('首页热门排行', 'haoui'),
'id' => 'most_list_s',
'std' => true,
'desc' => __('开启', 'haoui'),
'type' => 'checkbox');
$options[] = array(
'name' => __('首页热门排行-模式', 'haoui'),
'id' => 'most_list_style',
'std' => "comment",
'type' => "radio",
'options' => array(
'comment' => __('按文章评论数', 'haoui'),
'view' => __('按文章阅读数', 'haoui')
));
$options[] = array(
'name' => __('首页热门排行-标题', 'haoui'),
'id' => 'most_list_title',
'std' => __('一周热门排行', 'haoui'),
'type' => 'text');
$options[] = array(
'name' => __('首页热门排行-多少天内', 'haoui'),
'id' => 'most_list_date',
'std' => 7,
'class' => 'mini',
'type' => 'text');
$options[] = array(
'name' => __('首页热门排行-显示文章数', 'haoui'),
'id' => 'most_list_number',
'std' => 5,
'class' => 'mini',
'type' => 'text');