月別ページの年月の表記を変更する場合

パーマリンク設定をデフォルトにしている場合。

<?php if(is_month()): ?>
<p id=”pagetitle”>
<?php
$thisyear = substr($m, 0, 4);
$thismonth = substr($m, 4, 2);
echo $thisyear . ‘年’. $thismonth . ‘月’;
?>
</p>
<?php endif; ?>

パーマリンク設定をデフォルト以外にしている場合。(←これにしてる。)

<?php if(is_month()): ?>
<p id=”pagetitle”>
<?php
echo $year . ‘年’ . $monthnum . ‘月’;
?>
</p>
<?php endif; ?>

コメント

コメントをお寄せ下さいませ~

コメントの投稿

This blog is kept spam free by WP-SpamFree.

* コメントの更新情報

トラックバック URL : https://aoitai.net/blog/archives/545/trackback