代码 在编辑文章页面加上标签列表 在编辑文章页面加上标签列表,点击填入标签栏.方便快速添加文章标签代码来自于泽泽社长的插件tagshelperTypecho_Plugin::factory('admin/write-post.php')->bottom = array('tagshelper', 'tagslist'); class tagshelper{ public static function tags...
代码 Typecho启用gzip优化加载速度 开启GZIP可以用来加快网站的打开速度 要如何开启GZIP压缩呢?找到网站根目录下的index.php文件,直接在<?php下面加入以下代码ob_start('ob_gzhandler');即可..
代码 创建一个跳转随机文章的独立页面 介绍创建一个随机阅读的独立页面演示https://typecho.team/random.html实现<?php /** * 随机阅读 * * @package custom */ if (!defined('__TYPECHO_ROOT_DIR__')) exit; $db = Typecho_Db::get(); // 统计符合条件的文章总数 $countSql = $...
代码 Typecho获取页面加载时间 在主题functions.php中插入/** * 页面加载时间 */ function timer_start() { global $timestart; $mtime = explode( ' ', microtime() ); $timestart = $mtime[1] + $mtime[0]; return true; } timer_sta...
代码 Typecho显示在线状态 /*** * 在线状态 */ function get_last_login($user){ $user = '1'; $now = time(); $db = Typecho_Db::get(); $prefix = $db->getPrefix(); $row = $db->fetchRow($db->se...
代码 Typecho 获取在线人数 在主题的functions.php中加入function onlinePeople() { // 使用 Helper 类获取主题路径 $theme_dir = Helper::options()->themeFile(Helper::options()->theme); $filename = $theme_dir . '/online.txt'; // ...