首页
留言反馈
网站导航
推荐
毒鸡汤
Search
1
非插件为typecho 文章生成微海报分享
18,938 阅读
2
主题移动端,样式下添加二级分类
15,461 阅读
3
主题 添加author page
14,770 阅读
4
主题添加移动端下边栏
12,779 阅读
5
EMlog添加评论者邮箱等级
9,122 阅读
typecho
dynamic
SuiYu
Emlog
xiuno
登录
/
注册
Search
标签搜索
代码
xiuno
php
css
typecho
评论
模板
say
js
修改教程
标签
珍惜
努力
recommend
善良
样式
调用
微笑
颜色
插件
Vincent
累计撰写
151
篇文章
累计收到
184
条评论
首页
栏目
typecho
dynamic
SuiYu
Emlog
xiuno
页面
留言反馈
网站导航
推荐
毒鸡汤
搜索到
2
篇与
的结果
2023-01-09
Typecho文章页面实现长久没有更新文章的提示
方法打开主题目录下post.php文件,在适当位置添加如下代码,一般添加在post-content后面(表示文章正文开始的地方) <div class="tip inlineBlock share" rel="nofollow"> <p> 本文最后更新于<?php echo date('Y年m月d日' , $this->modified);?>, 已超过<?php echo floor((time()-($this->modified))/86400);?>天没有更新。 如果文章内容或图片资源失效,请留言反馈,我会及时处理,谢谢! </p> </div>注意:代码引用的css是handsome主题内置的,如果要用在其他主题,请自行把这个css扒下来!
2023年01月09日
4,155 阅读
5 评论
2 点赞
2020-07-13
加载时间
在 functions.php 中加入以下代码: /** * 加载时间 * @return bool */ function timer_start() { global $timestart; $mtime = explode( ' ', microtime() ); $timestart = $mtime[1] + $mtime[0]; return true; } timer_start(); function timer_stop( $display = 0, $precision = 3 ) { global $timestart, $timeend; $mtime = explode( ' ', microtime() ); $timeend = $mtime[1] + $mtime[0]; $timetotal = number_format( $timeend - $timestart, $precision ); $r = $timetotal < 1 ? $timetotal * 1000 . " ms" : $timetotal . " s"; if ( $display ) { echo $r; } return $r; }然后,在模板中引用:<?php echo timer_stop();?>前台输出相关统计1.<?php Typecho_Widget::widget('Widget_Stat')->to($stat); ?> 2.<p><?php _e('氪星人自 <strong>2013</strong> 年建站以来,截至 %s 在设定的 <strong>%s</strong> 个分类 3.和 <strong>%s</strong> 个页面中, 4.发布了 <strong>%s</strong> 篇文章,收到了 <strong>%s</strong> 条评论。 5.', date('Y年n月j日G时i分'), $stat->categoriesNum, $stat->publishedPagesNum, $stat->publishedPostsNum, $stat->publishedCommentsNum); ?></p>文章字数统计在主题的functions.php中写入代码: function art_count ($cid){ $db=Typecho_Db::get (); $rs=$db->fetchRow ($db->select ('table.contents.text')->from ('table.contents')->where ('table.contents.cid=?',$cid)->order ('table.contents.cid',Typecho_Db::SORT_ASC)->limit (1)); echo mb_strlen($rs['text'], 'UTF-8'); } 然后在想要添加的地方之间加调用就ok <?php echo art_count($this->cid); ?>总访客数统计代码 functions.php 中,添加以下统计代码//总访问量 function theAllViews() { $db = Typecho_Db::get(); $row = $db->fetchAll('SELECT SUM(VIEWS) FROM `typecho_contents`'); echo number_format($row[0]['SUM(VIEWS)']); } 然后在你需要显示的位置(如:footer.php sidebar.php 等)插入以下调用代码 <?php echo theAllViews();?></span><?php _me("访客总数") ?>添加版权声明<blockquote> <strong>本文作者:</strong><a target="_blank" href="https://www.2025ly.com">ly's Blog</a> <br><br> <strong>本文链接:</strong><a target="_blank" href="<?php $this->permalink() ?>"><?php $this->title() ?> - <?php $this->permalink() ?></a> <br><br> <strong>版权声明:</strong>如无特别声明,本文即为原创文章,仅代表个人观点,版权归 <a href="<?php $this->options->siteUrl(); ?>" target="_blank"><?$this->options->title();?></a> 所有,未经允许不得转载! </blockquote>
2020年07月13日
3,371 阅读
2 评论
2 点赞