자사 사이트에는 '테가로그'를 삽입해 두었으므로 효과적으로 활용
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라서 간단히 해결됐지만
인스타 같은 경우는 플러그인이 더 쉬울지도.
