鍍金池/ 問答/PHP/ typecho歸檔如何自定義格式?

typecho歸檔如何自定義格式?

我現(xiàn)在是用著這樣的格式
/typecho/usr/themes/default/sidebar.php
2017-10-31_210117.jpg

<?php $this->widget('Widget_Contents_Post_Date', 'type=month&format=Y m')
->parse('<li><a href="{permalink}">{date}</a></li>'); ?>

前臺(tái)是這樣顯示的:
2017-10-31_210627.jpg

我想改成
2017年10月的格式,這要怎么修改啊。

我試過這樣的,但是不行,開著調(diào)試也不報(bào)錯(cuò)。

<?php $this->widget('Widget_Contents_Post_Date', 'type=month&format=Y年m月')
->parse('<li><a href="{permalink}">{date}</a></li>'); ?>
回答
編輯回答
貓小柒

修改 var-Widget-Contents-Post-Date.php文件中, 函數(shù)execute(), Line 85.
如我修改后的代碼如下:

   while ($post = $this->db->fetchRow($resource)) {
            $timeStamp = $post['created'] + $offset;
            $date = date($this->parameter->format, $timeStamp);

            if (isset($result[$date])) {
                $result[$date]['count'] ++;
            } else {
                $result[$date]['year'] = date('Y', $timeStamp);
                $result[$date]['month'] = date('m', $timeStamp);
                $result[$date]['day'] = date('d', $timeStamp);
                $result[$date]['date'] = $date;
                $result[$date]['count'] = 1;
            }
        }

頁(yè)面效果即是 2017-10

2018年7月19日 08:31
編輯回答
近義詞

請(qǐng)參照php的日期寫法
http://www.w3school.com.cn/php/php_date.asp

2017年8月10日 11:19