TIPS:
本篇文章旨在记录不完全基于Handsome自带美化方式的美化方式。
一、访客总数统计
在/usr/themes/handsome/functions.php
文件中添加以下统计代码
//总访问量
function theAllViews()
{
$db = Typecho_Db::get();
$row = $db->fetchAll('SELECT SUM(VIEWS) FROM `typecho_contents`');
echo number_format($row[0]['SUM(VIEWS)']);
}
在/usr/themes/handsome/component/sidebar.php
文件中插入以下调用代码
<li class="list-group-item"><i class="glyphicon glyphicon-user text-muted"></i><span class="badge
pull-right">**<?php** **echo** theAllViews();**?>**</span>**<?php** _me(**"访客总数"**) **?>**</li>
二、网站加载完成信息显示
复制一下代码到设置外观
-开发者设置
-自定义 JavaScript
/* 网站加载完成提示代码开始 */
function kaygb_referrer(){
var kaygb_referrer = document.referrer;
if (kaygb_referrer != ""){
return "感谢您的访问! 您来自:<br>" + document.referrer;
}else{
return "";
}}
$.message({
message: "愿你能在我的空间里,找到属于自己的那份安宁<br >" + kaygb_referrer(),
/*替换文字为你想要显示的消息*/
title: "网站加载完成",/*替换文字为你想要的弹框的标题*/
type: "success",
autoHide: !1,
time: "3000"/*弹框显示的时长(ms)*/
})
/* 网站加载完成提示代码结束 */
三、复制成功提示
复制一下代码到设置外观
-开发者设置
-自定义 JavaScript
/* 复制成功提示代码开始 */
kaygb_copy();function kaygb_copy(){$(document).ready(function(){$("body").bind('copy',function(e){hellolayer()})});var sitesurl=window.location.href;function hellolayer(){
$.message({
message: "如需转载,请注明出处!<br> 本文作者:Cheering<br>原文链接:<br>"+sitesurl,
title: "复制成功",
type: "warning",
autoHide: !1,
time: "5000"
})
}}
/* 复制成功提示代码结束 */
四、文章末尾版权显示
复制下面代码到你服务器文件路径usr/themes/handsome/post.php
文件里
<!--版权声明开始-->
<div class="entry-content l-h-2x">
<div style="padding: 10px;background: rgba(220, 220, 220, 0.22);font-size: 13px;border-left: 3px solid;text-align: left;">
<span>本文作者:<a href="<?php $this->author->permalink(); ?>" rel="author"> <?php $this->author(); ?></a><br></span>
<span>文章标题:<a href="<?php $this->permalink() ?>"><?php $this->title() ?></a><br></span>
<span>本文地址:<a href="<?php $this->permalink() ?>"><?php $this->permalink() ?></a><br></span>
<span>版权说明:若无注明,本文皆<a href="<?php $this->options->siteUrl(); ?>" target="_blank" data-original-title="<?php $this->options->title() ?>"><?php $this->options->title() ?></a>原创,转载请保留文章出处。</span>
</div>
</div>
<!--版权声明结束-->
可以参考我图中的位置