From d387a08864d0c4a1da1aa44c93c608534a48a0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E6=81=92?= <2323333339@qq.com> Date: Sat, 8 May 2021 15:54:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/function.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/function.php b/core/function.php index 0ac329f..ee5972e 100644 --- a/core/function.php +++ b/core/function.php @@ -248,6 +248,28 @@ function _getParentReply($parent) } } +function _getHistoryToday($created) +{ + $date = date('m/d', $created); + $time = time(); + $db = Typecho_Db::get(); + $prefix = $db->getPrefix(); + $sql = "SELECT * FROM `{$prefix}contents` WHERE DATE_FORMAT(FROM_UNIXTIME(created), '%m/%d') = '{$date}' and created <= {$time} and created != {$created} and type = 'post' and status = 'publish' and (password is NULL or password = '') LIMIT 5"; + $result = $db->query($sql); + if ($result instanceof Traversable) { + foreach ($result as $item) { + $item = Typecho_Widget::widget('Widget_Abstract_Contents')->push($item); + $title = htmlspecialchars($item['title']); + $permalink = $item['permalink']; + echo " +
  • + {$title} +
  • + "; + } + } +} + /* 获取侧边栏作者随机文章 */ function _getAsideAuthorNav() {