文章最后更新时间为:2022 年 01 月 16 日 12:39:21 Loading... ## 文章页内添加最近更新时间 cuteen主题目录的post.php里 </header> <hr> <?= Ctx::HeroTitleNoImg($this) ?> 替换为 </header> <hr> <?= Ctx::HeroTitleNoImg($this) ?> </header> <hr> <div>最后更新时间:<?php echo gmdate('Y-m-d', $this->modified + Typecho_Widget::widget('Widget_Options')->timezone); ?></div><br/> <?= Ctx::HeroTitleNoImg($this) ?> ## 文章最后添加访问者IP cuteen主题目录的functions.php里添加以下代码 //获取客户端IP function getip() { static $ip = ''; $ip = $_SERVER['REMOTE_ADDR']; if(isset($_SERVER['HTTP_CDN_SRC_IP'])) { $ip = $_SERVER['HTTP_CDN_SRC_IP']; } elseif (isset($_SERVER['HTTP_CLIENT_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif(isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) { foreach ($matches[0] AS $xip) { if (!preg_match('#^(10|172\.16|192\.168)\.#', $xip)) { $ip = $xip; break; } } } return $ip; 再打开post.php文件,在合适的位置添加 <span>当前IP:<?php echo getip();?></span> ## [RainBowText]文章阅读添加阅读时长[/RainBowText] ## 在post.php的合适位置添加 <div class="T-time">您阅读这篇文章共花了:<span class="T-time" id="stime"></span></div><script language="JavaScript">var ss=0,mm=0,hh=0;function TimeGo(){ss++;if(ss>=60){mm+=1;ss=0}if(mm>=60){hh+=1;mm=0}ss_str=(ss<10?"0"+ss:ss);mm_str=(mm<10?"0"+mm:mm);tMsg=""+hh+"小时"+mm_str+"分"+ss_str+"秒";document.getElementById("stime").innerHTML=tMsg;setTimeout("TimeGo()",1000)}TimeGo();</script> ## [RainBowText]所有a标签新标签打开[/RainBowText] ## 在head里添加 <base target="_blank"> ## 评论区回复添加@ 在functions.php文件添加 //获取评论的锚点链接 function get_comment_at($coid) { $db = Typecho_Db::get(); $prow = $db->fetchRow($db->select('parent,status')->from('table.comments') ->where('coid = ?', $coid));//当前评论 $mail = ""; $parent = @$prow['parent']; if ($parent != "0") {//子评论 $arow = $db->fetchRow($db->select('author,status,mail')->from('table.comments') ->where('coid = ?', $parent));//查询该条评论的父评论的信息 @$author = @$arow['author'];//作者名称 $mail = @$arow['mail']; if(@$author && $arow['status'] == "approved"){//父评论作者存在且父评论已经审核通过 if (@$prow['status'] == "waiting"){ echo '<p class="commentReview">(评论审核中))</p>'; } echo '<a href="#comment-' . $parent . '">@' . $author . '</a>'; }else{//父评论作者不存在或者父评论没有审核通过 if (@$prow['status'] == "waiting"){ echo '<p class="commentReview">(评论审核中))</p>'; }else{ echo ''; } } } else {//母评论,无需输出锚点链接 if (@$prow['status'] == "waiting"){ echo '<p class="commentReview">(评论审核中))</p>'; }else{ echo ''; } } } 然后到base/comment.php文件,把 <div class="comment-content" data-expand="查看更多..."><p style="display: inline;"><?= Ctx::Comment($comments->content) ?></p> </div> 替换为 <div class="comment-content" data-expand="查看更多..."><?php $parentMail = get_comment_at($comments->coid)?><?php echo $parentMail;?><p style="display: inline;"><?= Ctx::Comment($comments->content) ?></p> </div> ## 修改主题字体 后台css添加 /*修改字体*/ @font-face{ font-family:FontStyle; src:url("https://www.roaing.com/usr/themes/Cuteen/static/font/love.woff"); format("truetype"); } *{font-family:FontStyle;} i{font-family:none;} @media only screen and (min-width:0px) and (max-width:767px){.index-banner{height:50vh!important;}} 注意字体文件和字体名称 附: [记typecho美化(一)][1] [记typecho美化(二)][2] [1]: https://www.roaing.com/tymh.html [2]: https://www.roaing.com/mher.html Last modification:January 16, 2022 © Allow specification reprint Support Appreciate the author Like 1 如果觉得我的文章对你有用,请随意赞赏