トップページによくあるメモ書きです。 トップページに最新記事5件を日付・タイトルをリスト表示。 さらに過去30日以内の記事にはNEWアイコンを付けるコード。 <ul> <?php query_posts('posts_per_page=5'); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <li> <span class="date"> <?php the_time('Y年n月j日'); ?> <?php $days=30; $today=date('U'); $entry=get_the_time('U'); $diff1=date('U',($today - $entry))/86400; if ($days > $diff1) { echo '<img src="images/new.g
![WordPressでトップページに最新記事5件をリスト表示](https://cdn-ak-scissors.b.st-hatena.com/image/square/8d71ff5111e05619a10d29bb40d7aebaa75c8fbc/height=288;version=1;width=512/https%3A%2F%2Fs0.wp.com%2Fi%2Fblank.jpg)