由于本站嵌入了"手账"功能,请充分利用
在function.php中添加
function get_tegalog_last_updated() {
$rss_content = @file_get_contents('※目录');
if (!$rss_content) return date('Y年n月j日'); // ★返回今日日期
$rss_content = mb_convert_encoding($rss_content, 'UTF-8', 'auto');
$rss = simplexml_load_string($rss_content);
$latest_item = $rss->channel->item[0] ?? null;
if ($latest_item && isset($latest_item->pubDate)) {
return date('Y年n月j日', strtotime((string)$latest_item->pubDate));
}
return date('Y年n月j日'); // ★返回今日日期
}
index.php中
<div class="last-updated">
<p>最后更新日期:<?php echo get_tegalog_last_updated(); ?></p>
</div>
由于这是CGI程序,所以处理起来很简单
但Instagram之类的平台可能用插件更方便。
