diff --git a/README.md b/README.md
index 29e8872..5b86fc0 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
两位前辈做得已经很棒了,或许我所做的只是把他们的代码弄得凌乱不堪吧 :)
-注意:建议 `git clone` 下载([简易 Git 使用指南](https://github.com/mashirozx/Sakura/wiki/Git-%E4%B8%8B%E8%BD%BD%E3%80%81%E6%9B%B4%E6%96%B0%E6%8C%87%E5%8D%97));如果选择下载压缩包,解压后记得把文件夹名改回 `Sakura`,也即保证主题路径为 `/wp-content/themes/Sakura/`;请安装必装插件 [WP Statistics](https://wordpress.org/plugins/wp-statistics/);请留意主题说明里的其他注意事项。
+注意:建议 `git clone` 下载([简易 Git 使用指南](https://github.com/mashirozx/Sakura/wiki/Git-%E4%B8%8B%E8%BD%BD%E3%80%81%E6%9B%B4%E6%96%B0%E6%8C%87%E5%8D%97));如果选择下载压缩包,解压后记得把文件夹名改回 `Sakura`,也即保证主题路径为 `/wp-content/themes/Sakura/`;请留意主题说明里的其他注意事项。
主题使用说明见:
diff --git a/functions.php b/functions.php
index f13add1..53d05ce 100644
--- a/functions.php
+++ b/functions.php
@@ -7,7 +7,7 @@
* @package Sakura
*/
-define( 'SAKURA_VERSION', '3.1.8' );
+define( 'SAKURA_VERSION', '3.1.9' );
define( 'BUILD_VERSION', '2' );
define( 'JSDELIVR_VERSION', '3.6.7' );
@@ -440,15 +440,29 @@ if(!function_exists('akina_comment_format')){
}
/**
- * post views.
- * @bigfa
+ * post views
*/
function restyle_text($number) {
- if($number >= 1000) {
- return round($number/1000,2) . 'k';
- }else{
- return $number;
+ switch (akina_option('statistics_format')) {
+ case "type_2": //23,333 次访问
+ return number_format($number);
+ break;
+ case "type_3": //23 333 次访问
+ return number_format($number, 0, '.', ' ');
+ break;
+ case "type_4": //23k 次访问
+ if($number >= 1000) {
+ return round($number/1000,2) . 'k';
+ }else{
+ return $number;
+ }
+ break;
+ default:
+ return $number;
}
+
+
+
}
function set_post_views() {
@@ -466,18 +480,23 @@ function set_post_views() {
add_action('get_header', 'set_post_views');
function get_post_views($post_id) {
- /* 修改需配合统计插件
- * $count_key = 'views';
- * $views = get_post_custom($post_id);
- * $views = intval($views['views'][0]);
- * $post_views = intval(post_custom('views'));
- * if($views == '') {
- * return 0;
- * }else{
- * return restyle_text($views);
- * }
- */
- return wp_statistics_pages('total','uri',$post_id);
+ if (akina_option('statistics_api')=='wp_statistics'){
+ if (!function_exists(wp_statistics_pages)) {
+ return '请安装 WP-Statistics 插件';
+ } else {
+ return restyle_text(wp_statistics_pages('total','uri',$post_id));
+ }
+ } else {
+ $count_key = 'views';
+ $views = get_post_custom($post_id);
+ $views = intval($views['views'][0]);
+ $post_views = intval(post_custom('views'));
+ if($views == '') {
+ return 0;
+ }else{
+ return restyle_text($views);
+ }
+ }
}
diff --git a/options.php b/options.php
index ec192ab..1849610 100644
--- a/options.php
+++ b/options.php
@@ -924,6 +924,28 @@ function optionsframework_options() {
'std' => '',
'type' => 'text');
+ $options[] = array(
+ 'name' => __('统计接口', 'akina'),
+ 'id' => 'statistics_api',
+ 'std' => "theme_build_in",
+ 'type' => "radio",
+ 'options' => array(
+ 'wp_statistics' => __('WP-Statistics 插件(专业性统计,可排除无效访问)', ''),
+ 'theme_build_in' => __('主题内建(简单的统计,计算每一次页面访问请求)', '')
+ ));
+
+ $options[] = array(
+ 'name' => __('统计数据显示格式', 'akina'),
+ 'id' => 'statistics_format',
+ 'std' => "type_1",
+ 'type' => "radio",
+ 'options' => array(
+ 'type_1' => __('23333 次访问(默认)', ''),
+ 'type_2' => __('23,333 次访问(英式)', ''),
+ 'type_3' => __('23 333 次访问(法式)', ''),
+ 'type_4' => __('23k 次访问(中式)', ''),
+ ));
+
$options[] = array(
'name' => __('启用 baguetteBox', 'options_framework_theme'),
'desc' => __('默认禁用,请阅读说明', 'options_framework_theme'),
diff --git a/tpl/content-image.php b/tpl/content-image.php
index cc71758..2849885 100644
--- a/tpl/content-image.php
+++ b/tpl/content-image.php
@@ -35,7 +35,7 @@
- 热度
+ 热度
diff --git a/tpl/content-single.php b/tpl/content-single.php
index 610c65d..32da052 100644
--- a/tpl/content-single.php
+++ b/tpl/content-single.php
@@ -13,7 +13,7 @@
diff --git a/tpl/content-status.php b/tpl/content-status.php
index 633674c..0d12d04 100644
--- a/tpl/content-status.php
+++ b/tpl/content-status.php
@@ -31,7 +31,7 @@
- 热度
+ 热度
diff --git a/tpl/content-thumb.php b/tpl/content-thumb.php
index 6227038..76e36af 100644
--- a/tpl/content-thumb.php
+++ b/tpl/content-thumb.php
@@ -37,7 +37,7 @@ $the_cat = get_the_category();
-
热度
+
热度
cat_name; ?>
diff --git a/tpl/content.php b/tpl/content.php
index 724581e..2cd4c41 100644
--- a/tpl/content.php
+++ b/tpl/content.php
@@ -34,7 +34,7 @@
- 热度
+ 热度
diff --git a/tpl/single-image.php b/tpl/single-image.php
index 3d4d066..0463b26 100644
--- a/tpl/single-image.php
+++ b/tpl/single-image.php
@@ -15,7 +15,7 @@